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.

1 Solution

Accepted Solutions
adamdavi3s
Master
Master

Quick suggestion but why not just make life easier and have two list boxes which you hide and show?

View solution in original post

16 Replies
sushil353
Master II
Master II

Hi,

Please attach sample qv application for better resolution.

amigo007
Contributor III
Contributor III
Author

Added sample files.

adamdavi3s
Master
Master

Quick suggestion but why not just make life easier and have two list boxes which you hide and show?

amigo007
Contributor III
Contributor III
Author

The thing I have more than 2 columns wich needs to have list boxes (6 columns), so my idea was to change the content in one list box only  based on the content of the "flag" filter, i.e. based on another list box where I include the values pointing to the columns.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

What exactly isn't working in your Always-One-Selected-Country_Flag document? What do you expect to be displayed in the Country listbox?

adamdavi3s
Master
Master

Hmm yes that would be easier than 6 list boxes for sure, Qlik doesn't seem to like it though!

I will have a further play when I get a second.

adamdavi3s
Master
Master

Peter,

The list box displays the correct values but doesn't allow a selection in the relevant column

*edit* It does allow a selection but not when the country is in both columns, that makes sense really as Qlik doesn't know what to do with it

amigo007
Contributor III
Contributor III
Author

If you select one value from Country_Flag, you will not be able to select any value from Country list box.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Ah, I see. Selecting one category in Country_Flag blocks selection in your dynamic listbox...

How about creating two fixed listboxes, both called Country but one of them showing field Country1 and the other showing Country2. In each listbox, enter a Layout->Conditional show expression that is true only when the corresponding selection is made in Country_Flag. Align the two listboxes on top of each other...