sum multiple numbers of different identities.

2
Hi community, I am currently developing an app at my university as a project. I would like to ask you, if there is any easy way to get a sum of a list of different attributes. I would like sum prices of different objects? thanks for help:)
asked
3 answers
4

Hi Maximilian,

In the microflow, you can use Aggregate list activity to find the sum of prices of different objects of same entity.

answered
3

If it’s a list of objects, they are from the same entity. If so, you can use the aggregation action as described by stella. If you have multiple lists of different entities or you need to build a sum accross different attributes of your objects, you need to create multiple sums (with the aggregate list action) and add them up in the end.

Additional Note:
Mendix is optimizing the database call if you have a retrieve followed by an aggregate list action. It is then not retrieving the list, it does the aggregation on DB level. This faster than doing it at runtime. If you need to do multiple aggregations on the same list, it sometimes helps to retrieve this list multiple times and do an aggregation per list. If a list is used for multiple aggregations or for other stuff, the call will not be optimized.

answered
1

So in general, you have a list of the same type of objects and attributes then you can use the aggregation function, but I am not sure what you mean. Can you provide an example?

answered