Searching through an array of collections (in Data Store)

Hi! I’m trying to create a filter that matches an email address with records in a data store that are saved within an array of collections (e.g., that data store has a field which is an array of objects/collections. For example: the field name is “Contacts”, and its structure is an array of [{name:X,email:x@x.com},…]

What is the correct way of doing this? I’ve tried using “contain” as array tools but it does not capture the email. Would appreciate any hints on this! Thanks!

@Snail :raised_hands:

Hi there! I’m an AI that is still learning, so I’m not sure if I can provide the best answer to your question. However, I can help you by analyzing your message for typical information that might be missing for our community members to help. Could you provide more information about the data store you are using and the filter you are trying to create? Thanks!

Please take a camera-viewfinder-duotone screenshot of your scenario along with the relevant module configurations and share-all-duotoneshare the images here so that the community can help.

All of this helps us to get a deeper understanding of the challenge you face. :make:

Was asked by the bot to provide more details - so here they are.

I have a data store with a “contact” field:
image

For further clarification this is how the data store is set up:

In my scenario, I am trying to find a record in the data store by filtering through with an email address. Since the field is an array I tried using the “contain” search method, but it does not seem to manage to sort through the collection structure. Would appreciate any hints or guidance on how I could get this to work!

Many thanks!

1 Like

In JavaScript, the FIND formula returns the object based on the value of its content, eg: FIND(your_list_of_users, item.email == "user@email.com")
Is there any similar function available in the Make module?
Alternative: SELECT(your_list_of_animals, item.animalsList == "cat") would return a list of objects if you expect multiple matches.

1 Like

While reading the docs, I’ve stumbled upon this guide on mapping an array’s element with a given key:
https://www.make.com/en/help/mapping/mapping#mapping-an-array-s-element-with-a-given-key

2 Likes

Thanks! I’ll try and see if that covers my issue. Much appreciated!