Need to compare a String value from List Iterator with an enumeration value.
I am new to mendix development. I am creating a new micro flow. I have a list of objects say List A and another enumeration say Enumeration B. I need to remove the objects from the list if the value of one of the String type attribute (say employee type) of object is not one in enumeration. I add a loop and then while over the iterator add an activity as find, but during the find it complains that the String and enumeration can't be compared. LineColumnError 11The microflow expression is of type String but should be of type Enumeration ApplicationData.EmployeeType. As the enumeration is fetched from a drop down, and then I need to select the enumeration as Employee Type, I can't use getKey, getCaption on it. Also I can't change the attribute type from String to the enumeration in domain. Please suggest how can I achieve this. Ho do I remove the objects from the list where the attribute does not match with the enueration value.
I guess you could do a split where you compare the string value to all possible enum values, wrapped in toString(), like this:
$IteratorObject/StringAttribute = toString(ApplicationData.EmployeeType.Type1) or
$IteratorObject/StringAttribute = toString(ApplicationData.EmployeeType.Type2) or
When true, continue; when false, remove from list.
Downside is you have to remember to add a line to this for each type you may add to the enumeration in the future.