I have an Enumeration with Attend and Not Attend. How can I count the number of attendees and non-attendees in a Microflow?

0
I have an Enumeration with 'Attend' and 'Not Attend'. How can I count the number of attendees and non-attendees in a Microflow?
asked
2 answers
1

You could do the following

image.png

Step 1 Retrieve the entire list of attendees.

In step 2 filter based on the enum

image.png

Step 3 Count the result

image.png

 

And you can filter and count the NotAttend the same way.

 

For more information, you can check out the list section in the documentation.

answered
1

Hello Jeff Yu,

 

You need to retrieve the list of the entity the enumeration is an attribute on:

 

For example:

Student entity has an attribute attendance,

 

1. then you retrieve the entity student by xpath attendance = Attend and after that action you directly use the aggregatelist action count, then you have the amount of attended students.

 

2. after you do the same but then with the xpath attendance = Non Attend and directly after you do the again an aggregatelist action on your retrieve list this the amount of unattended students

 

image.png

 

 

The retrieve + aggregate list action is an optimized combination within mendix instead of giving back the full list mendix will give you back the result of the aggregation, note this only is optimized if you do not use the list later in the flow.

 

see also:

 

https://docs.mendix.com/refguide/aggregate-list/

 

 

Hope this helps 

 

Good luck!

 

 

answered