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: 
aarohipatel
Creator II
Creator II

List Box to include or exclude field data

Hello,

I want to create a list box with expression to include or exclude data value of an field.

Field: ABC_COMP

One of the Data Value is : XYZ_2020

List box should have a value: Exclude_XYZ_2020 and when this value is selected in the List box, XYZ_2020 should be excluded from the field ABC_COMP. This way, user should be able to include or exclude XYZ_2020.

I have tried:  =if(not match(ABC_COMP,'XYZ_2020'),'Exclude_XYZ_2020') 

It is working for exclude but when trying to click on it again to include the data, it is not working.

Please advise.

Thanks in advance.

 

Untitled.png

 

 

1 Solution

Accepted Solutions
aarohipatel
Creator II
Creator II
Author

I found a  solution to my requirement  .

Add 2 buttons

Exclude: 2 actions a) Select in field       b) Select excluded

Include: 1 action- Clear field

 

Thank you for helping me gain knowledge in other options.

View solution in original post

13 Replies
Kushal_Chawda

Is it not worth to explore the functionality of Select excluded values option in listbox? Why to make things complicated?

aarohipatel
Creator II
Creator II
Author

Hi Kush,

Could you please advise on how to achieve this through a button or any other suggestions.

Thank you.

Kushal_Chawda

You can create two buttons , Include & Exclude and setup variable values like below

For Include, set the variable value to 1 & for Exclude set it to 2

Annotation 2020-07-28 012826.png

 

Now you can create expression in listbox from below option

Annotation 2020-07-28 012752.png

 

You can use below expression

=if(vCheck=1,ABC_COMP,aggr(Only({<ABC_COMP-={'XYZ_2020'}>}ABC_COMP),ABC_COMP))
aarohipatel
Creator II
Creator II
Author

Kush,

I tried your suggestion. Buttons are not working for me. Could you please provide an sample qvw?

Also, if user can include/exclude using the buttons, why do we need list box in this case? Can we do it just using the buttons?

Note: ABC_COMP field has multiple data values. 'XYZ_2020' is just one of the data value.

           ABC_COMP is available as a list box  in the app. But user wants to include or exclude 'XYZ_2020' with one click and not from the available list box.

 

Either a list box with value 'XYZ_2020' OR buttons to include/ exclude  data value 'XYZ_2020' from field ABC_COMP

 

Thanks

Kushal_Chawda

Also, if user can include/exclude using the buttons, why do we need list box in this case? Can we do it just using the buttons?

Where to you want to include and exclude values then? Please see the attached qvw for clarification

aarohipatel
Creator II
Creator II
Author

Thanks Kush. This helps.

But, when excluded, it is not showing in the Current selection box that 'XYZ_2020' has been excluded. Something like, 'NOT XYX_2020'

Also, I have noticed that the not associated data values are not being displayed in the list box.

Example: data value 'C' is not associated to the selections in the report. When, I hit on the exclude button, both 'C' and 'XYZ_2020' are getting disappeared from the list box.

Kushal_Chawda

Why you want to show 'NOT XYX_2020' in current selection? When you already have button that  itself describes that value is excluded. What is exact requirement?

aarohipatel
Creator II
Creator II
Author

It is needed in Current selection box so that it is clear to users on what selections have been made while they are exporting any objects to excel.

Kushal_Chawda

What should happen when user selects 'EXCLUDING XYZ 2020'?