Need to have a Datagrid with sum of retrived object from database

0
As you can see i have these objects with a integer connected to it. I want to make a sum of ONLY the same type of object. Like A01 should be 177 and A02 should remain the same as a 0.   This is my microflow so far and i don't know what to do with that SumImportoDazio. I should expose it somehow but don't really know how.   EDIT: this is the domani model, so you might understand it better.
asked
1 answers
0

Hello Nicola,

 

To expose your Sum in the front end, you need to add it to a certain kind of object. 

This can be done in many ways, the best way really depends on your business case. 

Some possibilities:

1. in the datagrid you have the sum functionality this shows the sum of all the records present in the datagrid(this does not require an extra object or field), however it will in this case also count the a02 values

2. add it as an extra field on the controlloeffetuato and show it in your grid, each line will show the sum, you need to recalculate the sum everytime for every line

3. Separate Punto Controllo as a separate entity with an association to controllo effectuato, and add an attribute with total on the new entity. When you associate a new line to it you have to make the sum and update the Punto Controllo Entity, you could also do this with an Before Commit or a Calculated attribute(be aware of the usage of these powerful functionalities with respect to performance)

 

Many more variations possible also with non-persistent entities. Based on the limit info but purely on a feeling i think you should go for something like option 3

answered