Create a Thing based on comparing Fields

I’m new to Bubble and have a problem comparing fields.
I have four fields named 1, 2, 3, 4 and each field has a number.

I want to create a new field which will consist of the name of the field with the highest number.

for instance:
Field 1: 12
Field 2: 4
Field 3: 8
Field 4: 9

New field: “Field 1”

Thanks for help!

Sorry I’m new as well so I could be wrong. I don’t think you can create a new field with the same name as an existing field, which is what you seem to be trying to do.

Hi @jakob.askling - unfortunately you can’t dynamically create new data fields. If your app will be limited to just use Field 1-4 and have a 5th field to capture the highest #, then you can create those five data fields. Assuming fields 1-4 are inputs (I’m assuming the numbers will change), then you can figure out which field has the largest value and copy it to the 5th field (called “Largest Value” of type number).

Alternatively, you could have one input and create new “things” in a workflow (create new instances of a data field called “Field” of type number in the workflow). Using a repeating group, you can show all the values. Then you can determine the largest value in the repeating group and copy it to another data field (“Largest Value” from above). This field would not be in the repeating group.

Thank you for the response @nikolai!
Unfortunately, I couldn’t really apply your example to my program. I guess my information was too unspecific.

I am creating a survey/test with about 8 questions. Each question has 4 answer alternatives that remain the same in each and every question. For example, answer option 1, option 2, option 3 and option 4. I want to gather information on how many questions the user picked every option.

option 1: 3 times
option2: 2 times
option3 6 times
option 4: 2 times

I then need to add the name ( not its value) of that option that the user picked the most, in this case: “option 4”, as a field to the current user.

@jakob.askling - there’s probably a more elegant way of solving this but here’s one way. In your User Data Type, create Option 1 - 4 (type number). Also create a “TempNum” (number) and “TempOption” (text).

You’ll need a workflow that does the following (my example initiates workflow with a button). First step is to identify which Option has highest count. This assumes you’ve been keeping count of each respective Option for your User’s responses to the 8 questions. In my example, those Option counts are kept in the User Data Type Option 1, Option 2, Option 3 and Option 4 I mentioned above.

Then you’ll need 4 similar workflow steps to determine which Option had the max count. Here it is for Option1

And here’s Option 2. You can probably figure out Option 3 & 4 but let me know if not.

At the end of the workflow, TempOption will have the Option with max count.

Note this example doesn’t address when you have more than one Option with the same max count.

Does this get you closer to your goal?

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