Quick Question - How to filter a list using Not a certain string.

0
This list action will only give me ‘Debited Charge – Undisclosed’ objects, I want it to do the opposite. I tried using not(‘Debited Charge – Undisclosed’) but that’s not correct syntax for Mendix.     A bad solution would be to then subtract the filtered list from the original list, but surely there’s a better way.
asked
2 answers
2

Hi Lee

Your “bad” solution is actually not a bad one.

Another approach could be a new retrieve with an XPath using not(), yet, yours will probably turn out to be quicker.

Kind regards,

Leander

answered
1

These days you can also use the filter action “filter by expression”. Here you should be able to make a simple comparison with $currentObject/TranType != ‘YourString’

 

However, for something like a transaction type where you have a fixed list of options, I would suggest either using an enumeration or an object (if the transaction types need to be changed in the runtime), which is usually easier to work with than strings.

answered