To pass one id (parameter) from a list to a details page is easy. But how to select and pass many ids (parameters) and list details of all selected?
From an API data source I create a list of items and add a toggle switch.
I have added a property selectItem to the data so I can toggle the switch.
But I want to toggle On some items, click a button and then pass all the selected items to the other page.
Here I want to list details (and manipulate data) about all the selected items.
How can I do this?
I think the best way to do this is to create a list type app variable where you add the id’s of the selected items. Then in the details page, I would create a data variable collection of records, and filter the results according to what ids can also be found the app variable, like this:
And the formula in the Set data variable would be:
SELECT(outputs["Get record collection"].records, IS_IN_ARRAY(appVars.selected_ids, item.id))
This way only the items that were selected and put into the app variable will get displayed in the details page.
This was great! Thank you!
My App Variable - Button click - Set page variable:
SELECT(data.recipies, data.recipies.selectItem === true)
An in details Data variable - Set data variable:
SELECT(outputs[“Get record collection”].records, IS_IN_ARRAY(appVars.selectedRecipies, item.id))
Nice to filter data even before use.
Does this solution mean that the backend is sending the entire collection to the client (ie. the phone) and the filtering is done ON the client?
If so, wouldn’t it be better to build a list of selected IDs to send to the backend, where it would use that in a SQL “Select Recipes WHERE Recipe.ID IN (<your list of IDs)” ?