Skip to main content
mollyn6512
September 10, 2022
Question

How to Replace Special Characters [ , ], " from a local variable result

  • September 10, 2022
  • 5 replies
  • 1 view

Hi every one, 

I'm having a local variable that store data in a Json format then converted it into a type that Appian accepts:

a!fromJson(local!settings) 

and I get this as the result: 

Dictionary

    • name"Type"(Text)
      • value"["5"]"(Text)
        • valueDisplay""(Text)

          I want to get all the settings with value equals a particular ID, but it shows this error: Expression evaluation error at function 'wherecontains' [line 41]: Invalid types, can only act on data of the same type (Number (Integer), Any Type).

           index(local!settings, wherecontains(local!currentType.Id,local!settings),"value",null)

          I guess the issue is because value is now containing special characters. 

          Any one having a solution for this? 

          Thanks a lot in advance for your helps!

            5 replies

            harshitb6843
            September 10, 2022

            Just wrap the second parameter of whereContains() function in toInteger() and that should work. 

            index(local!settings, wherecontains(tointeger(local!currentType.Id),tointeger(local!settings)),"value",null)

            mollyn6512
            September 13, 2022

            Thanks Harshit!

            stefanhelzle0001
            Brainy
            September 10, 2022

            There are no special characters. wherecontains requires the data types to match. This is what the error message claims.

            mollyn6512
            September 13, 2022

            Thanks a lot Stefan!