Expression evaluation error at function 'contains' parameter 1 [line 986]: Invalid index: Cannot index property 'value' of type String into type List of Variant. Please help

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi! I've looked over your code and it seems like the issue is that your local!towerPopulate variable is not properly typed. Appian is compiling it as a "list of variant", which means that it likely contains your data but the data is set as a list of dfferent values instead of a list the relevant CDT or Map.

    So in your case, it seems like you expect local!towerPopulate to contain the key "value", so I would change your code to index into the local variable at the appropriate key, and cast it to a string.

    As a result, your code should look like this:

    reject(
      fn!isnull,
      a!foreach(
        items: touniformstring(local!currentTowerOwner),
        expression: if(
          contains(
            tostring(
              index(
                local!towerPopulate,
                "value",
                ""
              )
            ),
            touniformstring(fv!item)
          ),
          fv!item,
          {}
        )
      )
    )

    Please let me know if this doesn't work or if you have any further questions!

Reply
  • 0
    Certified Lead Developer

    Hi! I've looked over your code and it seems like the issue is that your local!towerPopulate variable is not properly typed. Appian is compiling it as a "list of variant", which means that it likely contains your data but the data is set as a list of dfferent values instead of a list the relevant CDT or Map.

    So in your case, it seems like you expect local!towerPopulate to contain the key "value", so I would change your code to index into the local variable at the appropriate key, and cast it to a string.

    As a result, your code should look like this:

    reject(
      fn!isnull,
      a!foreach(
        items: touniformstring(local!currentTowerOwner),
        expression: if(
          contains(
            tostring(
              index(
                local!towerPopulate,
                "value",
                ""
              )
            ),
            touniformstring(fv!item)
          ),
          fv!item,
          {}
        )
      )
    )

    Please let me know if this doesn't work or if you have any further questions!

Children
No Data