Unexpected Union in list operation

0
When you use Subtract to subtract items from a list, at this point Mendix changes the entire list to be a list of unique entities.  This then means we are not able to determine the numbers of each entity in the list which is a statistic we need.     How do we prevent Mendix from 'unioning' this list -  I would expect this should only occur if we explicitly union lists. ?
asked
2 answers
0

Hi

the problem is, subtracting from the first list will then cause Mendix to change the list into distinct entities. IN my own example my initial list was 6000 items. after subtracting 1 item, it changed into a list of 1000 odd distinct items and now I cannot count how many of each type.

 

So, if I have a list of fruit, 3 apples, 2 pears and a banana.  If I want to count how much of each, it isn't possible to filter on the first item (apples), find out there are three, then, remove these three from the list, and then go on to the next one.  

 

What I can do is loop through the entire list one by one and create running totals of each. However, this surely can't be the most efficient approach. It feels like this automatic refactoring of the list into distinct entities is not the correct behaviour.  This should only occur if required by the user surely

answered
-1

Hello Joe,

 Go through each item in the first list one by one. For each item, see if it’s also in the second list. If it is, take that one item out from the first list. In this way, you only remove the exact number of matching items and also track the number of times.

 

Best regards,

Monika.

answered