Check if value exists in a list of Things

Hi,
I have a Text element. How can I check if the Text value is in a field of a list of Things?

Text: abc

Thing 1’s fieldA – def

Thing 2’s fieldA – ghi

Thing 3’s fieldA – jkl

Thing 4’s fieldA - mno

Result here should be: “not in list”

But if Text value: “def” then result “exists in list”

This is for an element condition.

The only approach I can find that might work for this is using the Condition:

Do a Search Things’ fieldA first item contains Element’s value or Do a Search Things’ fieldA second item contains Text value or… etc etc.

But this would be very longwinded as I have a large number of Things to check. Is there a better way?

Hi there, @Louis-1832… if I understand your post correctly, you won’t be able to refer to the text element itself in the condition because you can’t get the value of a text element directly from the element. So, I set up an example that puts the value that appears in the text element into a custom state on page load, and with the custom state in place, this condition on an element seems to do what you described.

condition

Anyway, apologies if I missed the mark here, but I hope this helps.

Best…
Mike

2 Likes

Thanks Mike.

If I’m not mistaken your method requires that every fieldA in the list of Things contains the Text value for the condition to be True.

However, I want it to check if one fieldA in the list of Things contains the Text value for the condition to be True.

You are mistaken. :slight_smile:

If you give something similar to what I showed a shot, you should get the desired result. How do I know that? I actually tested it.

You’re right, it does work. Thanks for that!

1 Like