Saving quantities stored in Data grid2 as a sum by group

Hi. The Domain Model is shown below.   1. Parts [Entity]   - Item (String)   - UseQty (Integer) 2. PartsQty [Entity]   - GroupItem (String)   - SumUseQty (Integer)   Import 'Parts' Entity into 'Data grid2', enter information and save it. I'm wondering how to calculate the sum of 'UseQty' by 'Item' and store it in 'SumUseQty' of 'PartsQty' Entity. In short, sum by group.   [Ex. result] - Parts Input : Item Value / UseQty           A / 1           B / 3           A / 1           C / 1   - PartsQty Output : GroupItem / SumUseQty            A / 2            B / 3           C / 1   Thanks.
1 answers

Assuming there is an association many Parts belonging to one PartsQty

You could do two things (depending on if the sum is retrieved or calculated more often): Make SumUseQty calculated and call a microflow that retrieves all parts associated to the PartsQty and use SUM (Aggragate List) to calculated the value.

Or, SumUseQty can remain a regular field and make sure that on save of any Part Object, the value is recalculated.

You can take a look at this part (and the next section) of the Rapid Developer Learning path to decide what is the best option for you.