Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create listbox based on value selected in another listbox

Hello,

I have a listbox with two values A & B. I would like like to create another listbox based on the value A or B that I select in the first listbox.

Can you please help me with a solution for these?

9 Replies
tresesco
MVP
MVP

You can simply try expression like:

If( listbox1='A', 'Selected A', If( listbox1='B', 'Selected B'))


Or, if you are looking for something else, I suggest to explain your expectation in more detail.

Not applicable
Author

Hello,

Please see screenshot below below and qvw attached. I hope this may help you.

EDIT - added Alternative

Capture.GIF

Alternative:

Capture1.GIF

Not applicable
Author

Hello,

I tried the solution you mentioned but it doesn't seem to be working. I'll explain what I need in more detail.

I have a listbox called CITYwith two values A_CITY and B_CITY. In my data there are two columns by the name A_CITY and B_CITY. If I select the value A_CITY in the listbox CITY; I want a listbox called A_CITY to be created. When I select B_CITY the listbox A_CITY should disappear and listbox B_CITY should be created.

Not applicable
Author

Hello,

What you have mentioned is selecting a value in a listbox based on the value of another listbox. What I need is that the entire listbox should be created based on the value of another listbox.

In your example; based on value selected in Dim1 the listbox Dim2 should be created.

MarcoWedel

Hi,

one solution might be an island table for the field selector and a listbox expression using dollar sign expansion to generate the field name:

QlikCommunity_Thread_257394_Pic1.JPG

QlikCommunity_Thread_257394_Pic2.JPG

QlikCommunity_Thread_257394_Pic3.JPG

QlikCommunity_Thread_257394_Pic4.JPG

tabCITY:

LOAD * INLINE [

    CITY

    A_CITY

    B_CITY

];

tabABCITY:

LOAD * INLINE [

    A_CITY,  B_CITY

    A_CITY1,  B_CITY1

    A_CITY2,  B_CITY2

    A_CITY3,  B_CITY3

    A_CITY4,  B_CITY4

    A_CITY5,  B_CITY5

    A_CITY6,  B_CITY6

    A_CITY7,  B_CITY7

    A_CITY8,  B_CITY8

    A_CITY9,  B_CITY9

    A_CITY10, B_CITY10

];

see also:

The Magic of Variables

The Magic of Dollar Expansions

The Little Equals Sign

hope this helps

regards

Marco

MarcoWedel

another solution could be:

QlikCommunity_Thread_257394_Pic1.JPG

QlikCommunity_Thread_257394_Pic5.JPG

QlikCommunity_Thread_257394_Pic6.JPG

tabABCITY:

LOAD RecNo() as ID, * INLINE [

    A_CITY,  B_CITY

    A_CITY1,  B_CITY1

    A_CITY2,  B_CITY2

    A_CITY3,  B_CITY3

    A_CITY4,  B_CITY4

    A_CITY5,  B_CITY5

    A_CITY6,  B_CITY6

    A_CITY7,  B_CITY7

    A_CITY8,  B_CITY8

    A_CITY9,  B_CITY9

    A_CITY10, B_CITY10

];

tabCITY:

CrossTable (CITY, CITY_Value)

LOAD * Resident tabABCITY;

hope this helps as well

regards

Marco

Not applicable
Author

Hi Marco,

I tried this option and it works. However; there's a rider to it.

There is one more table with fields REGION & CITY. The regions are X,Y,Z.

In the lisbox that I am creating dynamically along with =$(=CITY) I also want to only show the corresponding city values that I select for REGION = X. Can you please help me with this?

Regards,

Ayandeep

MarcoWedel

maybe like this?

QlikCommunity_Thread_257394_Pic7.JPG

QlikCommunity_Thread_257394_Pic8.JPG

tabCITY:

LOAD * INLINE [

    CITY

    A_CITY

    B_CITY

];

tabABCITY:

LOAD * INLINE [

    A_CITY,  B_CITY,  Region

    A_CITY1,  B_CITY1, X

    A_CITY2,  B_CITY2, X

    A_CITY3,  B_CITY3, X

    A_CITY4,  B_CITY4, Y

    A_CITY5,  B_CITY5, Y

    A_CITY6,  B_CITY6, Y

    A_CITY7,  B_CITY7, Y

    A_CITY8,  B_CITY8, Z

    A_CITY9,  B_CITY9, Z

    A_CITY10, B_CITY10,Z

];

hope this helps

regards

Marco

MarcoWedel

please close your thread if your question is answered:

Qlik Community Tip: Marking Replies as Correct or Helpful

thanks

regards

Marco