display a subset of Enumeration

0
Hi, all.  I have a entity with a Enumeration attribute. X with value of A,B,C,D. Can I just display A,B,C in a dropdown list, because D is a system generated value, and I don't want to show it to the users. Can I use the microflow to calculate it?? TIA
asked
3 answers
1

Hi Andes,

As far as I know, you cannot hide specific enumeration option. There are couple of work arounds you can implement;

  1. Easy method – You can add an onchange event and add logic to show validation message if user select option D (using this option will still show option D but upon user selection they get validation message)
  2. Change this from enumeration attribute to an entity. (this option may need data migration logic to be added if the app is already in use). For this option you need to;
    1. Create an entity (say X) and add association to your MainEntity (many to one, i.e. one X entity object is associated to many MainEntity objects) 
    2. Add attributes 
      1. Name (string to give name A,B,C,D etc)
      2. IsActive (Boolean)
    3. Add admin pages to create required options
    4. Create required options (e.g. A,B,C,D), set isActive = True for all except option D (the option that you want to hide from users)
    5. On the users page add reference selector instead of dropdown (replace enum dropdown with reference selector) and select data source attribute path (e.g. X_MainEntity/Name)
    6. Go to selectable objects tab and add XPath [IsActive] (this means only options where isActive=True will be shown)

Hope this helps!

answered
1

And an easy sollution is using this widget: https://appstore.home.mendix.com/link/app/56183/Finaps/EnumSelector

Regards,

Ronald

 

answered
0

Thanks Ronald. I follow the doc to setup the widget, but met a issue. I map two options (A and B) of Enumeration attribute of X entity to this widget, but not setup the the microflow. 

com.mendix.core.CoreException: User 'manager' attempted to execute the microflow with action name '', which does not exist.
    at com.mendix.webui.actions.client.ExecuteActionAction.execute(ExecuteActionAction.java:79)
    at com.mendix.webui.requesthandling.ClientRequestHandler.$anonfun$handleRequest$2(ClientRequestHandler.scala:166)
    at com.mendix.webui.requesthandling.helpers.StateHandling.withState(StateHandling.scala:35)
    at com.mendix.webui.requesthandling.helpers.StateHandling.withState$(StateHandling.scala:32)
    at com.mendix.webui.requesthandling.ClientRequestHandler.withState(ClientRequestHandler.scala:28)
    at com.mendix.webui.requesthandling.helpers.StateHandling.withState(StateHandling.scala:29)
    at com.mendix.webui.requesthandling.helpers.StateHandling.withState$(StateHandling.scala:22)
    at com.mendix.webui.requesthandling.ClientRequestHandler.withState(ClientRequestHandler.scala:28)
    at com.mendix.webui.requesthandling.ClientRequestHandler.$anonfun$handleRequest$1(ClientRequestHandler.scala:164)

answered