Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!
The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.
Hi,
I have a code like below where I am getting a list of text strings into a local!leadIDs. When I try to use contains() function to check whether a specified string exists, then I am getting an error like
Expression evaluation error at function 'contains' [line 11]: Invalid types, can only act on data of the same type (Any Type, Text)
Can someone advise, how to fix this.
a!localVariables( local!leadIDs: index( rule!getLeads(key: null()), "id", null()), contains(local!leadIDs, "AB12345"))
Discussion posts and replies are publicly visible
contains() is finnicky about data types - you should try the following:
contains( touniformstring(local!leadIds), "ABCDEFG" /* etc */ )
This will force-cast "local!leadIDs" to "array of string" type instead of "array of any type", and will not trip up contains().
That was a HUGE help. I have been struggling immensely with how picky contains is with the types. I have been doing casting, until I stumbled upon a situation in which something simply refused to cast to an array of text. This solved by problem, bypassing the need to cast.