Improve the type Enumeration: keep their values as-is. - Mendix Forum

Improve the type Enumeration: keep their values as-is.

4

Currently an enumeration value has a Caption, Name and Image. Unfortunately the name is a name and not a value and thus bound the restrictions of variable-names. Like never start with a digit, never start with a reserved word. If so, the variable-name gets prefixed with an underscore.

Since you are not always in control of the enumeration's values, for instance when processing data received from a consumed webservice, you can't always avoid an enumeration's value to get modified when imported. A '0' will get stored as a '_0', the text starting with 'Object' will get stored as '_Object'. Mind you: a value '_0' will also get stored as '_0' and '_Object' as '_Object'. There is no way of knowing the originally received data.

The Enum-value attribute 'Name' should instead be 'Value' and not be bound to variable-name's restrictions and thus keep the it's content as-is.

Also, you should be able to choose a dataype for you Enumeration.

asked
1 answers

Agreed, especially on the point of reserved words. For example, it's impossible to store a complete list of two-letter country codes, because DO (Dominican Republic) and ID (Indonesia) both aren't allowed values.

Created