Compare value with an array list of values

Hello,

Let’s say I have retrieved an entity from one system that looks like this:

“LineNumber” : “”
“ItemNumber” : “1234567”
“PurchaseNumber” : “”
“items_with_sn”:[
0 : “1234567”
1 : “ABCDEFG”
2 : “AA11BB22CC”
]

I want to compare the value of “ItemNumber” with the values on the “items_with_sn” array list, and if there is a match I want to create a key with the value “match” otherwise the value should be “no_match”.

How can I achieve this dynamically without having to hard code the values of the array?

I have right now the below conditional formatter


but I don’t want to type the values, in the future they could be changes.

Thank you

Hi @g.nikolian ,

You can try creating a “Value Setter ” and applying the JMESPath “contains ” function to the value, as shown below:

&{contains(items_with_sn , ItemNumber)}

1 Like