For preventing duplicates we want to check if an item already exists. We do this in a 'Save' microflow together with other validations. This does a retrieve with XPath constraints like [GroepNaam!=$Stam_KG/GroepNaam] But how can I compare this case insensitive (and trimmed)? The variable I can trim(toLowerCase()) beforehand if neccesary, but what about the attribute?
Mendix does not trim string attributes when storing them, but you could do this yourself in a before commit action.
Case sensitive/insensitive searching will depend on the database you're using. As far as I know all supported databases CAN be case insensitive or case sensitive but I believe only postgres is case sensitive by default.