Help Checking if a Value is already in a Data Collection

Can anyone help me? This must be basic, but I can’t get it to work.

I have something that I think should be simple, but is driving me nuts.

  1. I’d like to have 2 dropdowns
  2. combine the selected values in each into one string
  3. look for that string as a value in my collection of data associated with a specific key.

Step 1 - easy enough. I’m using MAP() to display valid options in each dropdown.
Step 2 - I bound each of the selected options to page variables and combine them as a formula into another page variable. bound to pageVars.Index. No problem.

Step 3. I’m stuck.
I have a filter on my backend data called Index, so if I input pageVars.Index into my Get Index filter, it will return only the record that contains that specific Value. This seems to work when I test Get in the Data section.

I would have thought I could just use LOOKUP(data.whatever, "Key") to return the Key’s Value that matches Index


A. Maybe it is returning list of objects with only one object, so lookup doesn’t work?
if so, wouldn’t something like
IS_IN_ARRAY(VALUES(data.whatever),pageVars.Index) at least give me a true/false? I wouldn’t think I’d need to filter the Data collection for this to work.

B. Maybe after I select something in the dropdowns, do I need to Get data again using the filter? I’d use an event trigger for this.

C. I tried using FIND(), but that works with Lists. So I combined that with VALUES() like this

I really just want a True/False if that particular combination of inputs has been tried before for now.
Eventually I’d like to be able to return other values from that particular record if it is True.

Thanks all


So if I understood correctly, you have a page variable with a string and you would like to check if there is an item with that string value in your data resource?

LOOKUP() only works on an object, not a list of objects. I’d say your suggestions of IS_IN_ARRAY(VALUES(data.whatever),pageVars.Index) would work. More simply, you could use IS_IN_ARRAY_BY_KEY() to avoid using VALUES()

This all assuming that your data resource is a list of objects and the pageVars.Index is the string you want to check if it already exists. Correct me if I’m wrong and let us know if you worked it out!

1 Like