Allow filtering a list by Rule - Mendix Forum

Allow filtering a list by Rule


Currently, if you want to filter a list on a more complex condition than can be expressed in a simple expression, you are bound to either:

This is a proposal to allow filtering a list on a Rule. The Rule gets the list element as its only parameter. If it returns true then the element is accepted, otherwise it is rejected.(*) This way, we can build much more powerful filters and keep the model readable at the same time.

(*) A Rule can also return an Enumeration value. This would either be disallowed, or we could allow to filter on the rule result being equal to some expression.

2 answers

Great idea!
Alternatively, allow expressions in the find/filter. That would allow you to compare against values from the context.

Something like:

$currentObject/Age >= $MinimumAge and $currentObject/HasDriversLicense



This is a wonderful idea, and should also apply to “find” operations