I´ve created a repeating group with inputs inside like the image below. What I want to achieve is to have the total price of the whole repeating group´s price so I can make the total of the invoice.
Here is the app: https://bubble.io/page?type=page&name=new_invoice&id=mynewtestapp&tab=tabs-1
I´ve figured out to have a workflow so when an input of the list is changed it´s been submitted but I would like to have the total without having to send the information to the database.
Anyone knows if this will be possible?
If I’m understanding what you are looking for, you can just run a query searching for the “amount” column, then attaching the “:sum” suffix on it. (Of course you can also add whatever other restrictions on the query to just get the values for that particular invoice, too.)
Here’s a screenshot and I also added a block to your sample.
I did that but I thought it could be possible to do it without sending the data to DB but no go.
You could add the totals to a custom state as you went along.
And then display that.
I think I´ll have to start learning about this custom state thing and try what you say.
What I want to achieve really is this (I´ve just posted in the forum): Subtotals based on the tax %
Maybe this just a nuance, but in the :sum approach there is no sending data to the db, but rather you are getting it from the db. The other question I’d ask is why is this a problem? In my years of development work it’s most always been that the simplest approach for solving the problem is the best course of action. It seems the simplest in this case would be a quick sum query from the database. It’s not an expensive transaction (doesn’t require a lot of resources and is very quick), and requires less logic that drumming up state variables.
Of course there’s no pressure to go this way, but just my thoughts.
Yes, that works if you update the database when the amount is changed in the row. But if you wait until the next row is added you don’t get the full total.
@NigelG is right,
I think it is the way to go.
I have the same problem and I am following your solution. However, I see a problem. If the value of the amount of a row that has already been added to the total (custom state) changes, then the new amount value would also be added to the total.
How could I avoid that?