Hi,
I have a journey which triggers an event (first activity)
The parametrs in the event are - an array called "legs" and "customer Number" .
I am using a condition activity to check if a specific value within the array exists.
Within the condition, I am passing the array and value as parameters using the "in" function.
Below is the expression:
If i check for the array at position 0, or at position 1, the expression looks correct with no error. However, if I want to search the whole array using "all()" the expression throws an error as below . How do I check if a value is present in all of the array?
Below is the schema structure:
Thanks in advance.
Ishani
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @IshaniVShah ,
To check if a value is present in all elements of an array, you can use the "every" function in combination with the "in" function.
The "every" function takes a function as its argument, which is used to evaluate each element in the array. The "in" function returns a boolean value indicating whether a given value is in an array.
Here's an example of how you could modify your expression to check if a value is present in all elements of the "legs" array:
legs.every(function(leg) { return leg.value === "specific value"; });
This expression will return true if the "specific value" is present in every element of the "legs" array, and false otherwise.
Hi @IshaniVShah ,
You can iterate throught the array using below syntax:
{{#each context.journey.profile.ArrayBetLegs.xxx as | legs |}}
{{ legs.name }} = {{ VALUE }}
{{/each}}
Hi @IshaniVShah ,
To check if a value is present in all elements of an array, you can use the "every" function in combination with the "in" function.
The "every" function takes a function as its argument, which is used to evaluate each element in the array. The "in" function returns a boolean value indicating whether a given value is in an array.
Here's an example of how you could modify your expression to check if a value is present in all elements of the "legs" array:
legs.every(function(leg) { return leg.value === "specific value"; });
This expression will return true if the "specific value" is present in every element of the "legs" array, and false otherwise.
Hi,
How can I use your function when my condition code looks like this:
containIgnoreCase(@{ord_paid._company.igOrder.igEntries.at(0).igArticleName.igArticleNameNL}, "geldterug")
or containIgnoreCase(@{ord_paid._company.igOrder.igEntries.at(0).igArticleName.igArticleNameNL}, "aanbetaling")
Thanks!
Views
Replies
Total Likes
Views
Likes
Replies