Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
vom102
Contributor II
Contributor II

Selecting more than one listbox with expression

I am new to qlik and I am trying to either select 3 different values in a listbox or disable the non-applicable values. I've tried triggers and expressions but still cannot make it work:

When I select "Red" on the color box, I want Qlik to select "Apples", "Strawberries" and "Cherries" 

OR

When I select "Red" on the color box, I want Qlik to grey out "Avocado", " Banana", "Blueberries" and "Celery"

Test.JPG

This are the two methods I have tried with Triggers but I am not sure on how to have more than 1 value selected:

=Pick(match(Color,'Blue','Green','Red','Yellow'),'Blueberries','Avocado','Apples','Banana')

= if(GetFieldSelections(Color)='Blue','Blueberries',
   if(GetFieldSelections(Color)='Green','Avocado',
   if(GetFieldSelections(Color)='Red','Apples',
   if(GetFieldSelections(Color)='Yellow','Banana'))))

Thanks!

1 Solution

Accepted Solutions
abhijitnalekar
Specialist
Specialist

Hi @vom102 ,

 

Please modify your script as below and see the magic.

LOAD * INLINE [
ColID ,Food
1,Apples
4,Avocado
4,Celery
1,Strawberries
2,Banana
3,Blueberries
1,Cherries
];

LOAD * INLINE [
ColID,Color
1,Red
2,Yellow
3,Blue
4,Green
];

Regards,
Abhijit
keep Qliking...

View solution in original post

6 Replies
marcus_sommer
MVP & Luminary
MVP & Luminary

Within the most scenarios there is no need to select anything with actions/macros else the simple and direct selecting of values from the list-boxes is sufficient to get the wanted subset of data. Exactly for this has Qlik the associative datamodel which is easy usable by the color-logic of green + white + grey.

There are very seldom occasions in which it makes sense to take the efforts to put own logics on top of it - but it's never sensible to try to replace the native logics with own ones.

- Marcus

abhijitnalekar
Specialist
Specialist

Hi @vom102 ,

Agree with @marcus_sommer

Also is it possible to share the data? 

 

Regards,
Abhijit
keep Qliking...
vom102
Contributor II
Contributor II
Author

Thank you @marcus_sommer  and @abhijitnalekar 

What exactly do you mean by associative datamodel? Could you guide me on it please? I was thinking it was just a simple "AND" or "OR" I was missing in my logic (I tried & and |), but if there is a simpler way to do that it would be great. 

Attached is the data I am using to test. 

Thank you again!

marcus_sommer
MVP & Luminary
MVP & Luminary

Associative data-model means that the data are - properly - linked to each other. In your case that color and food are associated and selecting the color red makes this value green within the list-box and leads to white values of apples, cherries, ... within the food list-box. An additionally selecting of those food values is not needed - it wouldn't have any added value.

- Marcus

abhijitnalekar
Specialist
Specialist

Hi @vom102 ,

 

Please modify your script as below and see the magic.

LOAD * INLINE [
ColID ,Food
1,Apples
4,Avocado
4,Celery
1,Strawberries
2,Banana
3,Blueberries
1,Cherries
];

LOAD * INLINE [
ColID,Color
1,Red
2,Yellow
3,Blue
4,Green
];

Regards,
Abhijit
keep Qliking...
vom102
Contributor II
Contributor II
Author

Works perfectly! Thank you so much!!