Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
tom2013
Contributor II
Contributor II

Exclude values in listbox

Hi all,

I wonder if there's a way to select the values in a field that belongs exclusively to a value in another field by using list box.

A simple example to make it clear:

From the table below I would like to filter out all the products that have only been ordered by customer B, and not by A.

So if I select value A and B in Customer field first, can I exclude all the products that has been ordered by A (001-003), so only product ordered by B (004) will be selected.

Thank you in advance.

Untitled.png

Customer  Product

A             001

A             002

A             003

B             003

B             004

1 Solution

Accepted Solutions
ashok_rajm
Contributor III
Contributor III

Ok.. I think you con't directly achieve this in Front end, because there is no any key which says this unique value. 

I was able to create it with back-end and front-end.

Listbox expression: = if(GetSelectedCount(Customer)>0,if(WildMatch(Customer, '*B*') and Key <> 1 ,Product),Product)

And back-end you need to create a flag for each unique values for B:

TT:
LOAD * INLINE [
Customer, Product
A, 1
A, 2
A, 3
B, 3
B, 4
B, 5
];

Load Product,1 as Key Resident TT where Customer = 'A';

Capture1.PNG

Hope This Helps.

View solution in original post

8 Replies
ashok_rajm
Contributor III
Contributor III

Do you want to exclude in backend or in front end.. Can you specify more details and what results you are looking for..
tom2013
Contributor II
Contributor II
Author

Thank you for your reply, I have updated the question description. I want to know if this could be done in front end by using list box, so I can get the desired data range for my chart.

ashok_rajm
Contributor III
Contributor III

Incase if you have Customer A,B,C and if you select A, B & C together. what results you would need.
tom2013
Contributor II
Contributor II
Author

I would like to filter out all the products that have been ordered only by Customer B, not anyone else.

ashok_rajm
Contributor III
Contributor III

 

So what i understood is, if you Select A & B, You need only Product 4 to be shown in the Product list box as 4 is the only Unique Product from B.

Capture.PNG

tom2013
Contributor II
Contributor II
Author

Yes exactly

ashok_rajm
Contributor III
Contributor III

Ok.. I think you con't directly achieve this in Front end, because there is no any key which says this unique value. 

I was able to create it with back-end and front-end.

Listbox expression: = if(GetSelectedCount(Customer)>0,if(WildMatch(Customer, '*B*') and Key <> 1 ,Product),Product)

And back-end you need to create a flag for each unique values for B:

TT:
LOAD * INLINE [
Customer, Product
A, 1
A, 2
A, 3
B, 3
B, 4
B, 5
];

Load Product,1 as Key Resident TT where Customer = 'A';

Capture1.PNG

Hope This Helps.

tom2013
Contributor II
Contributor II
Author

Hi Ashok, 

Thank you so much for the detailed answer!