list in workflows

0
Hi i have a case that i need to add items to a list in my WF   i have two questions 1- how do i eliminate duplication in my list . 2- is there a way to check if the list is empty or not.
asked
2 answers
0

Hi Alaa,

   1. There is not a Mendix list action to 'dedup' lists, but there are several ways to tackle your problem depending on how you are getting your list.  This forum post has some good ideas that will get you a unique list. If you want to isolate or remove single objects from the list, you can use the 'find' or 'equals' list operation.   here is some documentation on the list operations in Mendix.

   2. Checking if a list is empty can be accomplished in two ways.  You could use an 'Aggregate List' option to count the list.  Once you have that count, you can check the size of that list using something like $count > 0.  You could also do a simple empty check like $List != empty, which will be 'true' if the list contains any objects.

answered
0

Rob's answer is not totally correct. If you use the union operation on itself you will end up with a unique list. So select list operation, choose union and select the same list twice. The result is a list with unique records.

Regards,

Ronald

 

answered