Comparing a list to reference set in a microflow decision

Posted in Mendix on Jan 23, 2024 · 1 min read

Q: Will a decision in a microflow comparing a list and a reference set work?

A: Technically it’s possible to compare a list of objects. But it will only return true if the objects in both sets (the list of objects and in the association) are ordered identically. While a decision comparing a single object to a reference will always evaluate correctly, this is not necessarly the case for comparing a reference set and a list of objects.

Example: in the following domain model CaseObject has an association of type reference set to Action. In a microflow one would be able to have a list of actions and compare that to association: $IteratorCaseObject/MyFirstModule.CaseObject_Action=$ActionList. Example domain model with CaseObject <em>-&gt;</em> to Action

The order of the objects in a list is typically defined by the retrieve (or any sorting applied to the list). While the order of the reference set is determined by the order in which the association was set, which is a lot harder to predict - specially if the association is updated in multiple flows.

The list operation equals is the best solution if you want to compare two lists, because with equals the order does not matter. But it does require you to actually retrieve the objects via the association.