Cannot save a calculated value to a DB field (a bug?)

Hi all,

I have a simple calculation in a repeated group like
price * quantity = totalPrice

The calculation is processed by the equation in the ‘initial content’ for the totalPrice field. It works fine at this point.

Then I create a workflow to update the value of totalPrice in the DB when the field value is changed. It works well with the manual input but when the field content is updated automatically (based on the equation) the DB is not updated. This looks like a bug.

Is there a workaround for this?

Thanks a lot!

You have to check if your input field is set to number and your database field you use in the workflow is also set to number.

Sure, both input and DB field are ‘numbers’. I also tried the bundles number (DB) / integer (UI) and number (DB) / decimal (UI) - same error

can you post screen to show us how you format the data in the element and in the workflows? + you can also add screens of the DB

Thanks for the reply @bartek.dev

That’s fairy simple, the input settings:

image

The workflow

The DB type

Again - the workflow works when the input value is changes manually and doesn’t work for the calculated amount

Yes, everything looks right. I’ve never user RG to do calculations, so I’am not sure if I can help you.

Also check
a) if your formatting within repeating group is also right
b) what does the debbuger says? no issues there?

Thanks, I’ve found a solution - I update the total price in the DB every time a value in price or quantity changes. Then I show the actual value from the DB in the total price field. Appreciate your effort to help here @bartek.dev

2 Likes

You might want to figure out better way to do it. I don’t know your app but making changes in database everytime inputs value changes is not efficient. I will cost you a lot of workflows and capacity in the future.

Try saving it to “states”

1 Like

Yes, this is the way to do it.