Group List by Attribute

1
Hi, I’m Retrieving an List within an Microflow. The List looks like this: Now i need to group them by the first Attribute ‘Maschine’ and then build the SUM of theire ‘Arbeitsstunden’. But how it is feasible to do that. Of Course I could Retrieve all by ‘OS 13’ , ‘OS 6’ and so on but yeah thats realy stupid and not really a usable approach to my use-case. So maybe someone know how to do it.
asked
3 answers
8

Hi,
Grouping can be done via OQL or Via microflow

OQL:
Select Maschine,sum(Arbeitsstunden) from {ModuleName.EntityName} groupby Maschine

Microflow:

Create new list.

Loop though the list (where the ‘Arbeitsstunden’ needs to be grouped)

Using find operation in the new list to find the object which has same ‘Maschine’

If the object is empty, add it to new list

If the object is not empty, add the ‘Arbeitsstunden’ to the existing object

Finally return the new list

 

 

 

answered
-1

After retrieving the list, perform list operation ‘Filter’ to filter the list based on attribute value ‘Maschine’.

 

After filtering you will get new list, you can do aggregrate list for the new list , select the respective attribute to get sum of that particular attribute values. 

 

answered
-2

When retrieving from database, you can set one or multiple sort criteria (marked in the screenshot). When retrieving via association, you need to sort the list in a list operation as already mentioned by Steffy.

answered