Pass Variable from button to Sub

4
Lets say I have a bunch of buttons each with a name that corrosponds to an enum. Liked = enum.Accepted Ok = enum.neutral Disliked = enum.negative +5 more   I currently have a MF for each button, that creates a variable for the enum, then goes into a sub, and does the thing it needs to do. my quetsion, is there a way to just add the variable into the button, so i dont have to create all these MF's that pass on a variable?
asked
2 answers
5

Not in the button settings directly, no. 

However, what’s the reason you must use buttons for the enum values? A radio button or dropdown widget would make your life way easier here.

If you really want to stick to buttons and reuse the same button with only one microflow, one could in theory render a list view that creates a non persistent object with an enum attribute for each enum value in a data source microflow and renders a button with that enum value as a parameterized caption. It goes without saying that this is obviously too complex and doesn’t really save you time or complexity either. 

answered
2

If you only want to show a subsection of the statuses using a radio button you have the following alternatives:

  1. Create a separate enum that has fewer values and covert that to a another enum that has all the values in the subsequent save microflow or
  2. If security isn't important: Use CSS' n-child selector and a dynamic class to hide the x elements so that the user can't select them. For example to hide the first value: 
    .hide-first-radio {
        .radio {
            &:nth-child(1){
                display: none !important;
            }
    }

    or

  3. Use The DynamicEnumPicker widget, but be aware that community widgets may have certain limitations and Mendix does not offer official support for them
answered