Solved

Filtering using multi-selects


I have a form with two multi-select controls populated with data from a database.

 

Multi-select 1 shows a set of values from a database table - let's call this Asset Code. User can go into the form and select one or more Asset Codes.

 

Multi-select 2 needs to show Design Codes, each of which has an associated Asset Code. I want to populate this second multi-select to only show Design Codes where the associated Asset Code is one of those selected in multi-select 1.

 

If the user selects a single Asset Code from multi-select 1, it works. We see design codes that match that asset code. But as soon as the user selects two or more items from multi-select 1 (which was the whole point of having the multi-select control) it fails.

 

Variant 1: If I used the default "filter the data according to another control's value" tick box, then it tries to use the Asset Code(s) as an input mapping and doesn't retrieve anything as soon as there are two values.

 

Variant 2: I went in and changed the Populate rule to use a filter instead of an input mapping, trying various variants of Asset code in the control equals asset code in the Smart Object, or the control value contains the Smart Object value. However I've tried to configure this filter, I end up with ALL of the values populating the multi-select control, instead of only the ones where the filter applied.

 

Does anyone have any suggestiions for how to get this filter to work?

icon

Best answer by jessmeats 10 July 2019, 09:01

View original

2 replies

Hello,

I am not sure if we can use a filter with a Multi Select control that has multiple selections in it. I think this throws the filter off and it is unable to be resolved.

I found a workaround but it's annoying and feels like a hack rather than a nice solution.

 

I have a parameter. I have a rule that runs when the first multi-select changes. This rule transfers a blank value into the parameter and then does a "for each selected" loop on the contents of the first multi-select, so that each time it sets the value of the parameter to the current value of the parameter with a space and then the value from the multi-select. So once it's done the rule, the parameter contains a list of all the items selected in the first multi-select. I can then use this parameter in the filter rule for the second multi-select, so the values are only shown if the parameter contains the associated asset code.

 

It feels inefficient and awkward because it has to run the rule every time but it acheives the end result I'm after.

Reply