Filter unique email id from list

0
Hi, I have a scenario in which i want to filter the list which has duplicate email ids and save it to another list with unique email ids. I have one list called RequestList which has let say total 50 records. In which there are only 5 email ids used I want to filter those 5 unique email ids and store it to other list which i can use further. for that i have created temporary entity called emailunique and created a microflow. It first check the if emailuniquelist has data or not, if no then add to list and if it has data then loop through it and check for duplicate records. For 2 records it works fine but as the size of the emailuniquelist increases from third record it kept adding duplicate entries as loops through it. i am attaching image of microflow. please help
asked
2 answers
0

One option is to use the ListUtils: https://appstore.home.mendix.com/link/app/81827/

 

See its documentation:

Example 4: List clean-up, removing redundant items

You may want to clean-up a list by removing duplicate items (i.e., items with the same attribute value). This can be achieved by using the Filter function with the following filter to get the unneeded redundant items:
<xsl:for-each-group select="record" group-by="@lastname">
<xsl:if test="count(current-group()) > 1">
<xsl:for-each select="current-group()">
<xsl:if test="position() > 1">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:for-each-group>

 

If you want to do this with your own microflow, you can keep it simpler:

https://modelshare.mendix.com/models/237d17b1-2480-4a80-a424-65481c544387/get-list-having-unique-values

answered
1

You are missing a break inside the loop. See updated screenshot with my mad photoshop skillz

answered