Calculate Values based on dynamical number of sliders in repeating group

Hi there,
quick question. I have sliders in a repeating group like the following:
Screenshot 2022-11-16 at 18.38.32

Each RG Row is based on the thing called “Position”. Later, I want to give the user the chance to alter 1 field with the slider (but only after pressing ok, thus the value is not yet edited when using the slider).

I want to calculate some value based on the current slider values and other attributes of the thing of each row. Since, as stated, the values are not yet in database, I need somehow have access to the values in each row. Then do a multiplication of this slider value with another field from the corresponding “position” and sum all these values up … I don’t know how to do it…

Some ideas/ workarounds?
Thx :slight_smile:

// While thinking about, I could copy the hole list of Position elements, bind the value so these actually change with the slider and calculate based on this. But its ugly, I need to replace/ delete these elements… if a user reloads the side or closes the browser, I lose track on those items that are needed to be deleted…

If you don’t have too many sliders (I see only 3), I’d get them out of the RG
That way you can easily access the dynamic value of each slider and use it for a real-time calculation on a text field that displays the results


Cheers,
Ranjit / Atomic Fusion: Accelerate your Bubble dev with the community’s shared assets

The number of needed sliders is not fixed and could be between 1 and 25…

Ah ok
In that case you’d want to store the value of the sliders somewhere global.

One way is to use url parameters
Your result can then simply refer to the url parameters to make the calculation

So when input is changed
go to page (same page), add parameters:
key = input<current cell's index> and value = this input's value

So your url will have parameters like domain.com?input1=250&input2=340

And your text that shows the result will make calculations on values it obtains from ‘get data from url’

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