Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Group Field in Multi Box

Hi,

I have a multi box with a country drop down list. I would like to group the European Union countries within the list under the heading EU so that when EU's selected, all EU countries are chosen. Without this functionality, I need to hold ctrl and select each country one at a time.

Any suggestions would be appreciated, unfortunately I haven't been able to find any posts that address this issue. I've included a sample doc with the country list I would like to create the group for.

Best,

Matt

13 Replies
Not applicable
Author

Hi Matthew,

I guess if you created a mapped load statement with columns Country, Continent, you could try to use set analysis with the Possible option. But this is however the "dark side of the force" to me. Very powerful, but also quite mysterious.

The best call would be to use the hierarchy function. Don't get too complex about it, just map the right field names in your enviro to the parameters in the function. Hierarchy function is also quite useful, especially the hierarchybelongsto, but I am not the right person to ask about how to implement in practice.

If I was in your shoes, I'd just do a basic hierarchy load, put a front end list box i TreeView mode and allow end users to make a selection on this. The problem with set analysis is the structure (mapping) has to already exist, even if you are using "possible" (P...) in set analysis, hence you will anyhow have to alter the script to some extent, unless you already have the mapping structure existing in your data model.

Sorry I can't be of any further help. Maybe someone else will come up with a different, fast and smarter to way to get what you need.

Not applicable
Author

Thanks Pat - works perfectly.

Question, in the expression:

=if(match(Country,'France','Greece',' Spain','Belgium','Germany')>0,'EU')



Is the greater than zero a bin width?

Thanks

Matt

Not applicable
Author

Thanks Cheenu, as I mentioned earlier, I think your approach is the best long term. However today I was looking for a quick fix using set analysis.

Really appreciate the help.

Matt

pat_agen
Specialist
Specialist

hi,

the match() function compares the field Country against the values. If country was France then it would return 1, if Greece 2 and so on. If nothing matches it will return 0. If you put the field Country instead of the text 'EU' the drop down list would list all the countries in your function. insead of that it just shows the text 'EU'. So this expression is basically adding the attribute EU to all the countries you list inside the function.

It does what you want but best practice - for something as relatively unchanging as a country name and membership of an instutional group such as the EU would be best adressed by mofifying your load statement and adding the field CountryGroup for example with a value 'EU' for each member state. this could then be used all over your document rather than at each time having to use a complex function or set analysis.

just code it like this:

LOAD * INLINE [
Country, CountryGroup
Viet Nam, other
Iceland, other
Mozambique, other
Honduras, other
Japan, other
Kazakhstan, other
France, EU
etc.
etc.