I’ve managed to solve a lot of my issues so far by reading helpful forum posts but I’ve finally come up against something that I’m not having much luck with so here goes.
For background my app is basically a frontend for a rental database using the API connector, I dont use the app’s own database for anything at present, everything is non persistent and accomplised with custom states so far.
My issue I’m having is getting the toggle element action to reset when I clear a list in a repeating group. My app loads results (essentially a list of products) from an API connection into a repeating group which users can then search using the display list action. If a repeating group cell is pressed then this toggles (using the toggle action) the display of a group inside this which itself contains another repeating group with more information (the individual items of a given product). This all works reasonably well so far. I then have a workflow which resets the search using the clear list action but this leaves any toggled groups visible which I don’t want. I’ve tried using conditions to reference a custom state that gets set on resetting the search to hide the group again but have not had much luck.
Is there something I’m missing? From what I’ve read so far it seems interacting with elements inside RGs is maybe not the most straightforward of things.
Thanks in advance to anyone who might be able to help.
Jack, I know exactly the behavior you’re referring to. I was able to solve it by adding a field in the DB “showDetails”[y/n] and set a condition on the group in the the repeating group to be visible or not based on that field being “yes” or “No”. It worked out well in my use case because I also give the user the option to sort or move items in the repeating group around, so the “shown” details group follows it around based on the “current things shown is yes”.
But for your use case, because you’re only front end and might not have access or authority to modify DB schema, consider another approach…
Put a Custom State (CSShownDetailsList) on the main Repeating Group (RGMain) of type number and make it a list (check the list box). Then set a condition on your nested RG to be visible when CSShownDetailsList contains this cells current index.
Then instead of using the toggle element, have the WF set the state of the CSShownDetailsList on the RGMain to RGMain’s CSShownDetailsList :plusitem current cells index with a condition of only when CSShownDetailsList doesn’t contain current cell’s index. I then use the copy feature to duplicate the WF and modify the 2nd one to :minus current cells index only when CSShownDetailsList does contain current cell’s index. This should set up the toggle function. When you want to reset the whole group, set state CSShownDetailsList and leave it blank which will clear it out.