How to multiselect Mendix enum values in a form ?

3
Hi All, I have an Enum type which contains a set of values. I want to have a multiselect widget in my form which will show all the values of the enum and user can select multiple values and process further. I tried with drop down widget but it does not provide multiselect options. Also tried with reference set selector but am unable to proceed with this too as it requires a many to manu mapping of object types. Here my enum is not of object type. Is there any simple approach available in mendix can anyone please help me with this? Thanks, Bhola
asked
5 answers
2

Bhola,

The label selector is just an input widget, so it won't address your whole requirement. However, if you create a 'lookup' entity, lets call it ProductType, that has one attribute, Product Type, which is your enumeration. Remove the ProductType attribute from both the ReportParameters entity and the Product entity. Create a many to many association between the ReportParameters entity and the ProductType entity. Create a 1 to many association between the Product entity and the ProductType entity (each Product can have only one ProductType). Now you can prompt the user for parameters, using the ReportParameters entity and retrieve all of the matching products in your report processing microflow using XPath.

Have fun,

Mike

answered
0

Bhola,

You cannot multi-select enumerations in Mendix. In order to provide mult-select, you can create a many to many association (as you mention in our post) or you could create more than one attribute with the same enumeration in the entity you are working with. I am not sure of your app requirement, so I don't know if that's feasible.

If you decide to use a many to many association, I have found the label selector widget from the app store works great. Users can type in part or all of the value they want to use, they see a list of values that match what they have typed and can easily build a many to many association.

Hope that helps,

Mike

answered
0

Hi Mike,

Thanks for your quick advise.

My requirement is I have to generate a report by passing few parameters. I want all my input parameters bundled into an entity and pass to a microflow for further processing.

One of the parameter in my input entity is 'ProductType' which is nothing but a Enum which contains set of values. I am showing all the values now using a drop-down so I am able to pass only one of the selected value with that input entity. As client wants to select multiple 'ProductTypes' and generate the report I am failing to do so with the drop-down anymore.

Can you please help me if the 'Label Selector' can anyway solve my problem ?

Thanks again for your help.

Bhola

answered
0

You cannot have multi-select while editing because an attribute can contain only a single value. However, when searching/filtering, you can use multi-select on the search field. See 'Allow multi-select' on the following documentation page:

https://world.mendix.com/display/refguide5/Drop-Down+Search+Field

So, you can make a data grid with such a search field and then you can select multiple enumeration values and all records will be retrieved that match one of those values.

Does that help?

answered
0

Hi Arjan,

Thanks for your suggestion. We are currently using Mendix version 4.4.0 for our project and it seems like 'Drop-Down Search Field' multi-select widget has been introduced in 5.2.0 version.

Will try that once will upgrade to new version.

Thanks again.

Regards, Bhola

answered