I’m running into an issue with calculating a total sum in Bubble and could really use some help.
I have a list of items stored in a custom state.
Each item has a price and a quantity.
The list is displayed in a repeating group. Outside the repeating group, I have a text element that needs to show the total sum of (Price * Quantity) for all items.
if the user selects the item 20 times, the item is saved just one time with a quantity of 20. so the 20 is saved in the database. the item does not appear 20 times in de database. Not sure if that’s the correct answer to your question?
i would just save the :sum of the price for each line in the db so you have acces at all time to the sum of that exact line items sum and wouldnt hurt so when creating or making changes just include the sum as an extra field so you can later just say rgs each items Product, linePrice_sum, :sum
I really appreciate your help, but that’s exactly what I want to avoid. I don’t want to create an extra field in the database for the subtotal because I want to reduce workloads.