Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic listbox capability

Hello,

I have been trying with no success to populate a listbox dynamically based on the selection of another listbox.  I have tried to use an expression, but I seem to missing something.  Below is a description of what I am trying to accomplish:

Listbox1 = View

  • Full
  • Partial

Listbox2 = Colors

  • Blue
  • Green
  • Red
  • Yellow

When I click on Full from the View listbox I want to see all values in the Colors listbox, but when I click on Partial from the View listbox I only want "Blue" and "Green" to appear in the Colors listbox.  Can this be achieved?

Thanks!

7 Replies
Gysbert_Wassenaar

Create a table in the script that relates the values of the two fields with each other:

LOAD * INLINE [

View, Colors

Full, Blue

Full, Green

Full, Red

Full, Yellow

Partial, Blue

Partial, Green

];

Then when you click on Full the Colors listbox will show all colors and if you click Partial the listbox will show only blue and green


talk is cheap, supply exceeds demand
Not applicable
Author

This is very close to what I am looking for, but one side effect.  When I click on partial it shows all values, but red and yellow have a greyed out background.  What I want is to only show blue and green.  I clicked the hide checkbox, but it only shows the one that is selected.

Anonymous
Not applicable
Author

different approach, perhaps a bit complicated for your scenario, but with this expression you're able to use even functions or complex wildcards instead of just {"*"} or {"blue","green"} ...

Table1:

LOAD * INLINE [

    Selection

    Full

    Partial

];

Table2:

LOAD * INLINE [

    Color

    blue

    green

    red

    yellow

];

=if(GetFieldSelections(Selection)='Full','("'& Concat({<"Color"={"*"}>}  DISTINCT "Color", '"|"') &'")',

if(GetFieldSelections(Selection)='Partial','("'& Concat({<"Color"={"blue","green"}>}  DISTINCT "Color", '"|"') &'")') )

avinashelite

Its the default nature of Qlikview ...which ever you select will be highlighted in Green and relevant data in White and un-related data in grey....hide exclude will hide only the non relative data in our case you have selected the either green or blue value in the list box i guess...don't select any value in the list box and then check

Gysbert_Wassenaar

I recommend against it, but you can use an expression instead of a field in the multibox to hide the unselected values: =aggr(Colors, Colors)


talk is cheap, supply exceeds demand
Not applicable
Author

The =aggr(Colors, Colors) expression is the closest to what I am trying to achieve.  Why do you recommend against using the aggr? 

Pulkit_Thukral
Partner - Creator II
Partner - Creator II

If you have some linkage between these 2 list boxes then directly use hide excluded option