Help create the right condition in Workflow

How can I make the total sum of all values equal to 100 or less. If you select a larger value, the slider should return to the maximum allowable option. The values are all entered into the database. I tried to implement using Workflow, but I can not create the desired condition. Thank you all for your replies)
2022-07-15_081416

Hi there, @vik13develop… as with all things Bubble, I’m sure there are multiple ways to do what you described, and I made an example that demonstrates one of those ways. The key to this example is two workflow events for each slider… one event for when the slider input’s value plus the other two values from the database is less than 100 and one for when the slider input’s value plus the other two values is greater than 100.

The first event described above is pretty uninteresting because it contains a workflow action that simply sets a field in the data type to the slider input’s value and then resets the group in which all of the sliders reside. The second event, however, has to do a little work, and that work looks like the following. Note that I simply created three fields called slider 1, slider 2, and slider 3 on my User data type for the example.

The expression probably looks a bit convoluted because I am subtracting 100 and multiplying by -1, but it didn’t seem like I could enter 100 first and subtract the values of slider 2 and slider 3 from it. That being said, the expression I used works just fine.

Anyway, I hope I have understood your post correctly, and I hope this helps you get down a good path.

Best…
Mike

P.S. If your next question is how did I get the parentheses in the expression, check out the experimental parentheses feature if you haven’t come across it already.

2 Likes

Thank you @mikeloc for your time and detailed description! I couldn’t enter 100 and subtract other sliders’ values from it. That was my problem. Thanks to you I know how to do it. Only I forgot to indicate in the first post that sliders are elements of a repeating group and their number can be from 2 to 10. I will try to adapt your formula. Thanks @mikeloc!

2 Likes

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