Skip to main content
felixr
March 1, 2022
Solved

Cannot index "data" because it is an array type (List of Variant). Only fields with scalar types can be indexed from an array.

  • March 1, 2022
  • 6 replies
  • 1 view

Hi, Im facing this issue when i'm retrieving  a list of data from an integration and  casting it to a data subset  when i try to acces a  especific id in a expression rule everything works perfectly 

and it returns an  id but  when i do the same thing on a process model  it throws me this error that you see i tried many ways of getting this to work  and nothing. what could it be the problem that  i'm facing ?

below how looks like  the expression rule when i  use the   process model to get the  values

this doesn't work either

    Best answer by mikes0011

    Yes, in this case I'd strongly suggest doing some further digesting of the data within the Expression Rule and direct the output into a PV which is an array of a specific CDT, rather than the DataSubset type.

    6 replies

    gopalk2865
    Participating Frequently
    March 1, 2022

    Hi, I would suggest you check your data from integration. I can see your rule is not able to index "data", So try to check on that .

    mikes0011
    Brainy
    March 1, 2022

    This is a lot of information to try to piece together... but the one thing I notice in your error message is you're trying to call pv!invoicesList.data[1] - which of course will fail if pv!invoicesList is blank OR if the .data property is empty.  Can you confirm whether this PV actually has a value in your process instance?  You didn't show any confirmation of this either way.

    The Expression Guru
    felixr
    felixrAuthor
    March 1, 2022

    off course it has data this is the data it has. I know it is too much information but i wanted to be as  clear as posible

    gopalk2865
    Participating Frequently
    March 1, 2022

    It looks like ,you have nested dictionaries. I think you need to deal with your data in a  right manner so that indexing can be easy.