Mendix special check empty returns false for empty strings

If you clear an input field and then proceed to save and call the microflow that checks if this value is empty. When you debug and inspect the model. The value in the field (for example if it is a text input) will be ‘’ (single quote single quote). This is an empty string but it is evaluated by the special check empty as not empty. Observed in mendix studio pro 8.17 – this version is not yet available in the drop down Currently I am relying on checking that value for the ‘’ to get around this. What is the difference and what does special check empty consider empty? What would be the best way to check if an input has no value, in other words it is completely empty user hasn’t entered anything.  Validation is custom and is not against the persisted entity, I am using a ViewModel (UIModel) entity that is not persistable.
2 answers

Just addign my bit here – it seems the trim() function in Mendix auto-initialises any string with a value of null. This basically means that you never have to do an empty check on a string before running trim(). Best practice here, I'd say, is to use

trim($variable) != '’    => this will always work, and is the cleanest code. 


Do remember that in Java, or any other language, we first do an empty check, and only then can run a string function, or else we will get a nullpointer error.


Best regards,



empty is the equivalent of null in Java, there is no value at all. ‘’ is a String of zero length.

When I validate a String has content, I always check for not empty and that a trimmed version of the string does not equal ‘’.

You can also use IsEmtpyString and IsNotEmptyString in the Community Commons module to do a similar thing.

Hope this helps.