I have looked for hours to find a solution but it doesn’t seem there’s an easy one in the forum except using the bdk plugin.
I have a repeating group in which I have inputs. I do calculations in these inputs. I want to have the sum of all these inputs that are in the repeating group.
It seems crazy to me that there’s no build-in solution, to sum up, all inputs from a repeating group.
There is I think. If you chuck a custom state on the page or some other element (I always use the page for variables), you can add to the custom state as people change the values in the input RG.
Funny, I was trying to solve this last weekend and had the same solution as @steve18 . Looking at it again with a fresh head we were actually quite close. Only thing missing was to track the previous value and in that way increase the grand total by the difference (rather than the total for that cell).
I don’t know anything (yet!) on custom state. So I think I understand but I need to try things before I completely get it.
The inputs are calculated in RG with lots of data
You can’t just go ‘repeating group’s list of things’s field:sum’? Autobind that field to the input element and it will automatically update when the user changes the value in the element.
Or using the Expressions element with the Toolbox plugin and some custom states
I use a combination of both in my invoicing functionality.
Yep that’s fine if the data you’re summing up already lives in the database. That isn’t the case here. Doing this on the client side with custom states is quicker too.
So the user doesn’t need to input anything in the RG? Why are they input elements and not text elements if that is the case?
You might need the toolbox plugin and the expressions element or the instant calculator plugin to make life easier for yourself.
Or you could create new field in your data type for number of months and total plan amount, then trigger a backend WF on page load or group show to calculate new figures for each. Then you could use the repeating group’s list of items’ total plan amount:sum
So the user doesn’t need to input anything in the RG?
→ That’s correct
You might need the toolbox plugin and the expressions element or the instant calculator plugin to make life easier for yourself.
→ I have installed the instant calculator plugin but I don’t see how it should be helping
Why are they input elements and not text elements if that is the case?
→ So I can do the multiplication between the number of months and the total per month
Or you could create new field in your data type for number of months and total plan amount, then trigger a backend WF on page load or group show to calculate new figures for each. Then you could use the repeating group’s list of items’ total plan amount:sum
→ So I should create new data in my DB? Just to calculate the sum?
These calculations would be triggered when the page is loaded inside a repeating group? How to then automatically update the DB with these? It’s the same problem I’m facing I feel ;(
I tried to create a scheduled API WF but I can’t figure how to do it
I have tried with a Scheduled API Workflow and the Custom States method but I can’t sum an input from a RG nor I can update the DB with the individual Sums.
I just want the sum of inputs with the yellow background to show in the red background input !
Or to update the DB with all the yellow background when the page in loaded