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.
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.
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.
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.
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.