03-11-2021 02:44 PM
Does snaplogic have a mechanism like includes method?
e.g.
“AwardStatus”:[“ACCEPTED”,“OFFERED”,“CANCELED”],
Something like
$AwardStatus.includes(“CANCELED”) ?
03-11-2021 09:53 PM
Hi Acesario,
We don’t have direct method like .contains() like in the case of string . However we can use the indexOf functionality to find whether the particular element is present in an array or not .
$AwardStatus.indexOf(“CANCELED”)==-1?“Absent”:“Present”
Where -1 here means the given element is not present in an array else it will be present . Hope this clarifies the answer .
Also please refer the below documentation to explore more about array manipulation techiniques.
https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438091/Array+Functions+and+Properties
03-12-2021 12:09 AM
Hello @acesario ,
You can also use the following expression => .filter(x=>x == “CANCELED”).length != 0
If the AwardStatus contains “CANCELED” the expression will produce “true”, if not, it will produce “false”.
Best regards,
Bojan Velevski