Populating database with dynamic checkbox

Hello, please assist. I’m struggling to populate a database with a repeating group of dynamic checkboxes from a “Save” button:

  1. Authentic if the checkbox item has already been added to the database for the user
  2. If not, add each new item(s) to the database
  3. if a checkbox has been unchecked (that was previously checked)- remove item from the db

Thank you

There are some contextual variables that may change the approach here, but in general, if your checkboxes refer to a list of things that relate to a single database field, the setup would be as follows:

  • Create a custom state on the parent level repeating group that is a list of things
  • Create a workflow so that when the checkbox value is changed “only when->this checkbox is checked” → add item to custom state
  • Create the opposite workflow so that when the checkbox value is changed “only when->this checkbox isn’t checked” → remove item from custom state.
  • Create a workflow on a save button outside of the repeating group that says when the button is clicked → make changes to a thing → DB field list of things set list custom state list of things
  • Lastly, to make sure that your checkboxes populate with default values, set a page is loaded workflow that will set the custom state to be equal to the existing list of things from the database.

I hope this helps!

Thanks Sam, thank you for taking the time to respond.

All is working well according to your process above. A “custom state”, in my head, is an old fashioned #TempTable. I am populating the custom state/temp table and adding and removing checked selections successfully.

The last step - (point 4 above) - I am struggling to populate a data table for each of the selected checked items, through a “save selection” button/workflow- e.g. each selection listed in the custom state should populate a new row in a table, if the record does not exist already. (I don’t want the custom state list to be populated into a single row).

If I use :first item / :last item as a test the data is saved in the db but not every item in the custom state.

Thanks again


This topic was automatically closed after 70 days. New replies are no longer allowed.