How to how to create a loop (similar to FOREACH) on my array?

Hello,
I have two documents in my Firebase DB:
in the first I have the customer cards;
in the second I created customer groups
From these screens you can get an idea of the structure:

in my app I want to be able to select each group and view the list of all customers contained in that group.

This formula:

SLICE(SELECT(data.schedeDellaScienzaForGuest, CONTAINS(item.id, pageVars.percorsiSelectedPageVar[0].schede[0]  ) ), 0 ,100)

helps me select the group, but then shows me only the 0 (zero) element of the array ( schede[0] ). How can I create a cycle to see them all?

I hope I have explained
Thank you

1 Like

I solved it by creating a supporting array with the comparison list and then applying this formula:

SLICE(SELECT(data.schedeDellaScienzaForGuest, IS_IN_ARRAY(pageVars.percorsiListItems, item.id) ), 0 ,100)

if it can help someone else.

2 Likes