How to update database with calculations of input

Hi! I’m having trouble referencing an input several rows down that has conditional calculations and pushing the calculated value to data field. Any advice would be greatly appreciated!

1 Like

Hi @telaholcomb

Have you tried searching for the row you’d like to update by trying ‘Current row’s date - X days’? For example in your workflow, for the ‘One week ago’ input, you could search for the row ‘Current cell’s date - 7 days’, and then easily update the data for this row.

Let me know if that helps

Need extra help?

Book a free 15 minutes call - happy to help if I can

I can search/locate the appropriate row for updating. The issue is what that data is being updated with. The only options available are the Inputs of the Current cell not the the Inputs of the Current cell - 7 days.

I tried triggering a separate workflow when the calculation updates in the Input of the “Current cell - 7 days” row but it appears Bubble doesn’t see the value as changed because it is a conditional change and not a change initiated by the User?

I’m assuming these are inputs in a repeating group, and the problem is you are trying to reference an input on a different line in the repeating group from the line where the change is happening. Is that right?

And the inputs of the current cell - 7 days are not saved to the database, so you can’t change the reference from “Input” to “Do a search for” Is that right?

@robert That’s correct on both statements!

This workflow would be used to take the calculated inputs done on page and save them to a list in the data field.

If the calculation isn’t overly complex, could you just do it in the workflow itself?

For example, do a search for the record that is this record minus 7 days, and use whatever is already saved in the database to do the calculation.

2wk#Yrs Down = Do a Search for…'s 2wk#YrsDown minus this Input’s value (or something like that)

Referencing inputs in a repeating group for a calculation (example: summing them for a grand total) is not possible in Bubble. Two options…
#1 is to use BDK’s Repeating Group plugin to reference the inputs (or certain inputs) in a repeating group. I’ve used it and it does work.
#2 is to have workflows save the information back to the database on a change or certain triggers . This is tricky, and can slow down your app considerably if there is a cascading flow of changes to many items.

If you need to update a lot of records, you could do a backend workflow. I’ve done a lot of work with calculations, and made a lot of mistakes. Usually the problem was making things overly complex, or trying to do things outside of Bubble’s capacity with plugins or complex workflows. The best results I’ve had is to step back and redesign things to work more simply and more elegantly within the Bubble framework.


Thanks for the suggestions!

I’m using BDK’s RepeatingGroup Tools plugin to reference the inputs for the calculation. That part is working but after the calculation I need a few numbers saved to the database. It’s basic calculations so I’ll see if I can get it to work using a workflow instead of on the page.

1 Like

Thanks, Robert! Moving the calculation to the workflow worked!

1 Like

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