Hi all, We have a situation where, we have a list of possible values for a property. Example, assume the case of ‘transport’, which states the mode of transport to be used. We had earlier defined an enumeration and said ‘Bus’, ‘Car’ and ‘Bike’ are the possible values for the property ‘transport’. Then, we faced a situation where we should be able to add a new mode of transport and remove any mode of transport that is not supported any longer. So, upon reading through earlier questions posted on the forum, we realized that it is not possible to edit an enum except from the modeler. We wanted the supervisor to be able to edit the values in ‘transport’. So, we modified the app and converted the enum to an entity. This entity now contains a single attribute, which indicates the mode(bus or cycle, or car). Is it right to use the earlier enum as the datatype of this attribute, by which we mean that the attribute of the entity could take any one of the values from the earlier enum? Or is there a way to set default values to this single attribute of the new entity? How do we edit/add/delete the values that this attribute can take? Thanks in advance
An enum is a list of options defined at designtime and can't be changed in the runtime.
So using an entity to select the data is the way to go.
If you want to populate the entity the simplest way would be to create an overview and newedit page and allow someone to manage the data. Another option would be to create a microflow that runs after startup that creates the values and add the pages to allow for maintenance in the runtime.
I would add something like a boolean to set whether the option is active or not. Because when you delete the record the older records pointing to the record that you just deleted will no longer reference the data and you would loos the history. So on the page where you select the transporttype make sure the reference selector uses something like an xpath contraint like:
[active = true or id = object/relation_totransporttype entity]
The last thing is to make sure that the selected option that is maybe no longer slectable will stay set in the selector.