String Field with Drop-Down Values Based on list generated in a Microflow

1
Hello Experts -  I have a microflow to create a new form (MyForm), and I would like a field (MyField) on that form (which is currently a string) to be a drop-down (pick list) of values. I would like that field to remain an open text field in some cases, but on certain conditions it will be a list of values. In the microflow I am pulling the values that I want via an XPath constraint into a variable (MyValues). How do have my MyForm with MyField tied to a list of MyValues?   Thank you, Mark
asked
3 answers
0

Hello Mark,

What you're looking for is reference selectors (https://docs.mendix.com/refguide/reference-selector), you can use a reference selector to pick from a list of objects of type "MyDropdownValue" which you pre-populate with the values you want to have in the drop-down. 

From this point you can either give users the option to add objects of type "MyDropdownValue" implicitly expanding your selection or you can use a string attribute "MyDropdownChoice" on your "MyForm" object and either set that attribute as the value selected in the dropdown with an OnChange event or let them edit it if appropriate.

Hope the above makes sense and is useful!

answered
0

Anyone know of a way to have a field that uses a drop-down list that is generated from a microflow?

answered
0

Mark,

As far as I know, there is not a way to have a text field use a drop down list generated from a microflow (in fact, I don't think you can populate a text field with a microflow in any fashion).  The only drop down fields I am aware of in Mendix are reference selectors and drop down fields for enumeration attributes.  Since the values in an enumeration can't be changed at runtime, I think you'll need to figure out a way to do this with reference selectors.

While this may not be the answer you were looking for, there are a number good widgets for this type of requirement.  This first one you should look at is AutoComplete  This widget gives you a lot of flexibility around how you set a reference value and what values are displayed to the user.  You have the option of showing a set of reference values generated by a microflow or retrieved via Xpath (answers that part of your question).  You can also let users create new reference values (answers the 'text entry' part of your question).  It seems like this widget may be what you are looking for.

If not, check out Label Selector and Bizzomate Combo Reference Selector.

If none of those fit the bill, perhaps you could share a bit more about your requirement.

Mike

answered