[SOLVED] - How to create multiple things at once (either with a button press or when a recurring element loads ...)

This is surprisingly tricky to do, for a number of frustrating Bubble reasons that I won’t get into. That being said, the following seems to work, sort of, but I would be interested to see if anyone has a better approach.

The idea I had was to have a custom_state on the repeating group that is a list. I called it product_entries. Now every time a user enters a value in a cell, the product’s unique id and the value entered are added as a concatenated text (with a comma in between) to the product_entries custom state of the repeating group. So you end up with a list of all the values entered along with their corresponding product codes.

I then pass this list to an API Workflow (‘get_list_from_page’), which in turn runs another API Workflow (‘add_ph_entry’) on the list, adding each entry from the list to the ph_list table. The last bit requires some regex to extract the entered value from the text.

Some known issues with this are, a) if the user enters a value and then changes it, both values would be added I believe; b) the entered PH values are added as text rather than numbers; c) my regex is not great so there are trailing commas.

All of these are probably fixable with some more effort, but hopefully this gives you a starting point or some other ideas. Here is my editor to see what I did: https://bubble.io/page?type=page&name=productph&id=louisforum&tab=tabs-1

4 Likes