Nested DropDowns

I submitted this question earlier but I don’t think I was clear… I am new to mendix and am used to backend programming. I am trying to create nested dropdowns for example a "Shift" dropdown that will contain first shift, second shift, third shift. I also need an "Hours" dropdown that will dynamically change depending on which "Shift" is selected.   I have set up a macro flow to determine when the shift has changed and what it has been changed to I then have a changed object function block and in it I am attempting to write an expression to place an enumeration I have in MyFirstModule into the “Hours” enumeration but I keep getting the “No viable alternative” error.
2 answers

Mendix does not allow you to have enumerations filter each other. When selecting an enumeration from a dropdown, you will be able to select all values in the enumeration. However, Mendix can achieve what you want! To create a dynamic list, you will need to use the ‘Reference Selector.’

  • You will need to create two entities:
    • Shift – with the attribute ‘Name’ 
    • Hours – With the attribute ‘Value’ or something similar.
  • Create an association between ‘Shift’ and Task just like you have. 
  • Create a many-to-one association between Hours and Shift. 
  • Create a many-to-one association between Hour and Task also
  • On your Task page, put a reference selector using the association between Shift and Task
  • On your task page, beneath the Shift selection, put a reference selector using the association between Task and Hour
  • How can you populate your app with data then? To do this, you will also need to create an Admin page where you can create new entries in the ‘Shift’ table and to create the ‘Hours’ objects that are associated with each shift.




So if I understand correctly, you want all of the shifts to be in one dropdown. In that case, it seems that your problem is that you have each as their own property in the entity. What the change object is wanting is a specific value in side your enumeration to set the object to. What I would suggest is linking them together into a single enumeration with the values of 1st shift, 2nd shift, and 3rd shift. That should fix your shift dropdown, and then in your microflow you can change the value to be a specific value of one enumeration. I would have it look something like this:

However, if you want the dropdowns to limit each other, you will need to use a reference selector instead with a triangle like association like this:


Then if you make values for the hours entity, you can limit what it shows based on the shift entity reference selector in the selectable entities tab.