Empty string in nanoflows different to microflows - Mendix Forum

Empty string in nanoflows different to microflows

0

This is just a curiosity which may interest some people.

There have been a number of questions in the past about the difference between a string which has the value empty (null or undefined) and a zero length string '' in microflows. 

When validating for an empty string in microflows it is normal to use the check (1)

if $String = empty or $String = ''

This is commonly used - although there are other ways of achieving this check.

Conversely we might have (2)

if $String != empty and $String != ''

Sometimes a developer error results in (3)

if $String != empty or $String != ''

In a microflow (3) will always evaluate to true because the string cannot be both empty and ''.

However, I have found, by chance, that in a nanoflow, (3) works as the developer intended, regardless of the mistake.  It would seem that in a nanoflow empty and '' are equivalent. 

In principle therefore we don't need the two-part check in a nanoflow, although I would rather keep consistency between nanoflows and microflows.

I wonder if there are any other consequences.

Posted
0 comments