Expression for checking if an enumerate attribute is equal to an enumeration value.

1
Hi community! What is the correct way of writing an expression for an exclusive split for an enumeration attribute, where I want to check if the value is equal to one of the possible outcomes? Many thanks Austin
asked
2 answers
2

You have to enter the full enum name, e.g.:

$Object/Status = MyModule.Status.Active

Or you can simply split on

$Object/Status

btw. searching the documentation by 'enumeration' and/or 'split' would likely lead you to the right answer much faster.

answered
1

Hi Austin,

In addition to Fabian's answer, you can always use the getKey() function to get it's Key value if you ever want to match the Enum value to a string, i.e. if you want to check whether a String value from a webservice field matches an Enumeration value A:

String inputString
Enum EnumToCheck (ValueA, ValueB, ValueC)

Expression for your Exclusive Split:

trim(inputString) = getKey(EnumToCheck.ValueA)

 

You can also use getCaption() to get its caption (presentational value).
Also see Mendix docs: https://docs.mendix.com/refguide/enumerations-in-microflow-expressions

answered