Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
amigo007
Contributor III
Contributor III

Dynamic list box

I have a table with many columns on my dashboard, the table format and content is similar to this one (trying to show with dummy data):

Country_Category1CityStreetCountry_Category2CityStreet
SpainMadridstreet1SwedenStockholmstreet4

Germany

Bremenstreet2DenmarkCopenhagenstree5
BelgiumBrusselsstreet3NorwayOslostreet6
SwedenStockholmstreet4SpainMadridstreet1

I want to add a filter for countries but rather than adding filters per each Country_Category, I would like to have a flag called e.g. 'Country_Flag' in a list box with values: Country2 and Country2, etc.. and then to have another list box for countries which can dynamically be changed according to the flag in 'Country_Flag' list box.

Wanted to test with two countries, created a list box (called 'Country_Flag') with two values: Country1 and Country2. Then I created another list box (called 'Country' with field as an expression, here is the script for the expression:

If((GetFieldSelections(Country_Flag)='Country1') ,Country_Category1,
If((GetFieldSelections(Country_Flag)='Country2') ,Country_Category2))

Now switching between flag values changes the displayed lists in 'Country' list box. If I allow multiple selections in 'Country_Flag' list box and I select a country from 'Country' list box, both flags (Country1 and Country2) get activated. If click 'Always One Selected Value' from the 'Country_Flag' list box properties, the 'Country' list box does not work.

Note: in my table similar countries can occur both under Country_Category1 and Country_Category2

Any idea?

Added sample files with both scenarios: when multiple or a single value is selected in the list box.

16 Replies
amigo007
Contributor III
Contributor III
Author

Exactly

adamdavi3s
Master
Master

Peter,

I made this suggestion above

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Well, you post more rapidly than I can. Was still typing...

adamdavi3s
Master
Master

It was some time ago 😛

adamdavi3s
Master
Master

Ok one way around this is to load your country flag field with the same name as the fields you want to use and then use this formula in the list box:

=$(='['&Only({<$Field=Country_Flag>}[$Field])&']')

If you want to use different names then obviously you can use this as a base and create a mapping table to do this

adamdavi3s
Master
Master

Here is an example of the latter, using the mapped column

amigo007
Contributor III
Contributor III
Author

Awesome Adam and Peter! This works now.

Thanks and aprreciate your kind help.