Using enumeration to dispaly a list

0
Hi Mendix People! I have an attribute in my entity that i want to display as a drop-down list to chose from. List is predefined but, once or twice a year it will be updated with new items. I planned to use enumeration for this purpose, but i don’t know if admin will be able to update it later. So my question is: Is enum a good way to do it? (How to update it later from application?) Or should I solve it in different way? Thank you in advance for you response.
asked
1 answers
1

Hi Mateusz,

In my opinion you have two options here:

  1. Use an enumeration like you mentioned. This is the easiest way, however the options are limited to what you defined in the code. So it can only be changed by a developer and not by the admin and it will only change after releasing a new version to production.
  2. Create a new entity which has one attribute that holds the value you want to display in the enumeration. You make an association between the original entity and the new one. You can then create a page where the admin can create new objects of the new entity, thus creating new selectable options that are available immediately. In your edit menu you will then use a reference selector instead of a dropdown and associate the original entity with the new one.

 

Option two will give you way more flexibility and would be my preferred option if the enumeration has to be updated/changed by the admin. 

 

Hope this helps!

answered