Enumeration: Allow the string-attribute Name to have any value, also allowing it to be a reserved word or an integer - Mendix Forum

Enumeration: Allow the string-attribute Name to have any value, also allowing it to be a reserved word or an integer

2

See a problem caused by Enumeration's Name field not being allowed to have as a value a reserved word like 'ID': https://community.mendix.com/link/questions/91026.

Currently an Enumeration only has Caption, Name and Image. No problem as long as Name's value is not a reserved word like 'ID', 'int', or any integer.

Another example where this makes you having to do extra work is when you need to send a value in a REST-request and that value can be 0, 1 or 2 and nothing else. Using an enumeration makes sense, but you will need to prefix each Name with an underscore and pre-process your Response stripping the underscore.

Solution: Allow the string-attribute 'Name' to have any value, also allowing it to be a reserved word or an integer

asked
2 answers

Easy solution for this: Have the Mendix Business Server prefix every Name with an underscore (instead of just the reserved words and integers) before handing the Name-value to Java and have the MBS strip the same prefix upon receiving it from Java. 

Oblivious to us developers, MBS takes care of the rest for us. We only see what we type and want to see even if the name is any reserved word, even if it is an integer.

This is a minor change. Beauty is also: it is easy to make it backwards compatible.

Created

The way it is implemented in the Java-proxies prevents this.

Created