How to compare the length (or is empty) a retrieved list in a microflow

0
I have an action that retrieves a list of objects based on the XPath. Then I need to say "If the list is empty, ie has 0 items..THEN). But I cannot figure what is the right expression to use in the split.
asked
3 answers
4

Hi,

When you combine a retrieve and an aggregate count mendix will optimize these two actions into a COUNT query against the database, so you should be carefull if you plan to use the list elements afterwards.

You can also use

$MyEntityList != empty

to check if the list has 0 elements.

-Andrej

answered
0

You need an aggregate list activity to count the list
https://docs.mendix.com/refguide/aggregate-list

answered
0

Hey Michael,

You could try to do this in a microflow.
$ObjectList
Retrieve objects / Range: All / Output List / 
then
Make a split and just say
$Objectlist = empty
And save it

Then make the true and false statements you want.

If you also need the number you could do a Count between the Retrieve and Split.

This works for me atleast... dont know if its the best option

 

answered