cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Create a conditional (ie: If value includes to this) function against an array

mlodge
Deputy Chef I
Deputy Chef I

New to Workat and I am working with a schema that has some nested arrays and I cant seem to figure out how to create a if condition that will be triggered if any option in the nested array contains the specific value.


Example:

create a if condition where "Interests" contains "swimming" so that the data in the schema below is picked up


{

"deliveryContext": {


"camper": {

"demographics": {

"address": "string",

"city": "string",

"state": "string",

"country": "string",

"phone": "string",

"postalCode": "string",

"email": "string",

"firstName": "string",

"lastName": "string",

}

"Interests": [

{

"id": "34",

"value": "biking"},

{id": "27",

"value": "biking"}.]

}

}

6 REPLIES 6

dcornwell
Deputy Chef III
Deputy Chef III

It looks like the JSON has some errors in it but my guess is that the correct JSON is:

{"deliveryContext": {"camper": {"demographics": {"address": "string","city": "string","state": "string","country": "string","phone": "string","postalCode": "string","email": "string","firstName": "string","lastName": "string","Interests": [{"id": "34","value": "biking"},{"id": "27","value": "biking"}]}}}}


And the formula based on that would be:

["deliveryContext"]["camper"]["demographics"]["Interests"].pluck("value")

mlodge
Deputy Chef I
Deputy Chef I

David Cornwell - thanks, I quickly copied and modified the json to act as an illustrative example. thanks for the assist.

rayudu_addagarl
Deputy Chef I
Deputy Chef I

I think this works, Sample i tried.

https://app.workato.com/recipes/2239282?st=157230

rayudu_addagarl
Deputy Chef I
Deputy Chef I

workato's "parse json" does not work with complex json unfortunatley