Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ZoeM
Specialist
Specialist

Use same button to select and clear field

Hello Community.

I have a button which has a variable action to show/hide columns (dimensions) in my table chart when clicked.

I would also like this same button to be able to select values from a field and also clear the values when clicked. 

Variable expression for the dimensions is easy, if(vSS=0,1,0). All I would like is that if the result is 0, values in a field are selected. If the result is 1, the results are cleared. 

Is there an easy way to achieve this? 

 

Thanks!

Labels (2)
1 Solution

Accepted Solutions
rubenmarin

Hi Zoe, maybe I don't explain it right, I upload a sample to show how it can work with one button, the trick is having a conditional field name for actions:

rubenmarin_0-1596481264885.png

rubenmarin_1-1596481308328.png

 

View solution in original post

4 Replies
rubenmarin

Hi, I'm not sure to understand. To clear selctions in a field there is a 'delete field' action, and to select there is a 'Select in Field' action.

Each of them asks for a field name to select or clear selctions, in that name you can set an expression like:

if(vSS=0, 'FieldName')

or if(vSS=1, 'FieldName')

So you have both actions in the button but only one on them sets the correct field name based on vSS value.

ZoeM
Specialist
Specialist
Author

Hi Ruben,

Thanks for getting back to me. 

So I have a button that currently shows/hides fields in my table chart.

I want to add functionality to it so that it can also select text values or clear text values when the User chooses to Show or Hide the additional columns. 

My variable expression for showing hiding columns is if(vSS=0,1,0)

So if vSS =0 hides the columns. When the columns are hidden,I would like to set up an expression so that text values are selected from my specified Field Name i.e. if vSS=0, select 'John, James, Edith' from Field Name 'Sales Person'.

When vSS=1, the columns are unhidden. Set up an expression to clear selections in Field Name 'Sales Person'.

I do believe there should be a way of doing this with in one button vs. having two different buttons. 

Hope this adds more value to my request and thanks again for helping out. 

rubenmarin

Hi Zoe, maybe I don't explain it right, I upload a sample to show how it can work with one button, the trick is having a conditional field name for actions:

rubenmarin_0-1596481264885.png

rubenmarin_1-1596481308328.png

 

ZoeM
Specialist
Specialist
Author

You Mr Ruben are an All Star.

That is exactly what I wanted. I will use this scenario for countless other applications. 

Thanks a bunch for staying with me on this.