Forum Academy Marketplace Showcase Pricing Features

Query that loops through results

Sorry, very new to this.

I have the following db set up to handle a quiz:

-------Options (value “10”, name “Yes”)

I have a separate table storing results but I’m trying to determine the max value at the module level (max value for each question rolled up to module). So in essence, for each question find all the options and determine the max value. Then add all those question values together when they belong to a given module.

------optionA (value “5”)
------optionB (value “10”)

------optionC (value “5”)
------optionD (value “2”)
------optionE (value “7”)
------optionF (value “12”)

moduleA total would be: 10
moduleB total would be: 17 (5 + 12)

I can’t seem to find a way to do this and I need help!!

Thank you in advance.

I am also new to bubble so I don’t know how exactly to do this. That being said, in the tutorials I’ve followed there seems to be a way to search for data in a list and organize it in an order. If you did that for every question and then added the first option of every question together you might have your answer.

You pretty much have it there! Translating that to Bubble-ese:

Have a workflow just after anytime an Option is created, updated or deleted, as follows.

  1. Make a change to a thing → current Options’s Question’s Module (or however you have your relationships set up)

  2. “Max value” = Do a search for Options → constraints: Module = this Options’s Question’s Module → 's Value: max

That way the max will update for that Module anytime there’s a change.

…hope that makes sense.


Appreciate the help, Rob! That was just what I needed. I was using auto-binding on the creation of options and was able to trigger from the specific option’s value input being changed to alter the questions max score (I added a field to question called “max”).

Thank you for the prompt reply!

1 Like