Forum Academy Marketplace Showcase Pricing Features

Saving results of repeating group form

Hi,

I am working on an app where I need to save demographic information about a user (for example age range, income range, education level, etc). Each of those demographic characteristics are stored as a separate field within the User table (e.g. Age group).

Each demographic characteristic that I want to know is defined in a table called Category and has pre-defined options (e.g. age range can be 18 to 25, or 26 to 30, etc.) in a table called CategoryOption.

To update a user’s information, I’m using a repeating group that shows a Category (e.g. Age) as text and all pre-defined options as a drop-down menu (e.g. 18 to 25, etc.) next to the text.

I am hitting a road block trying to create a workflow to use these results to update the User table. I can’t seem to access the input data in the workflow. Is this possible? Is it also possible to dynamically select which table column to update based on the repeating group cell?

Thanks for the help!

There is a way to submit the data from the RG, but it may require that you structure your user table in an unintuitive – and perhaps even confusing – way (see below). If the categories displayed do not change depending on the user, I would really prefer to list the fields one by one without a RG. The code may turn out to be much more readable for you.

BUT if you need to do a RG (perhaps you are generating a different set of categories every time), here’s a quick brainstorm.

In my experience you can’t trigger a workflow using data within a repeating group unless the action triggering the workflow is in the repeating group itself. So you’re left with two different workflow trigger options:

  1. Have the dropdown’s value change
  2. (probably less ideal) Have a “submit” button in each line (ie, in the RG), and ask the user to click it when they’ve changed a value.

It’s possible…though not simple. Going with #1 (change in dropdown value) from above:

There’s a way to do it that requires a lot of different conditions, but the trade-off is that your data organization is more intuitive and simpler (let’s call it method a). The other method is simple code on the page, but your data organization needs to be more complex and may be harder to read (method b).

method a: you create a workflow that says “when dropdown input’s value is changed” AND (cell number is X) then change user’s category. You have to do this for every condition, ie have a lot of workflows. But if you find yourself wanting to do this method, you might as well just make a non-RG update page, because then you can update all of the user’s fields in one go, rather than doing this with a bunch of workflows.

method b: create a table that is of Category - Value pairs, and give users a field that is a List of Category-Value pairs. Create a system so that users during only have one of each category, in their list of Category-Value pairs. Populate the RG with a user’s list of Category-Value pairs. When a value is changed, then you can tell the workflow to modify the cell’s Category-Value pair’s value with the new value. The major drawback is that you won’t be able to see the user’s data neatly laid out in a table in Bubble’s Data Tab because it’ll be obscured in a list, but maybe you can create your own backend admin system to surface this information.

There are probably even better, more elegant solutions out there, but hopefully this gets you a little further.

2 Likes

Thanks for the quick response. Ya this sounds way too complicated for what I need (although good to have the solution in case I need it in the future!), given the same categories apply to each user I’ll just list each field. Cheers!

yup! :slight_smile: