Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Midastouch365
Contributor II
Contributor II

How to create a toggle function in a table

Hi everyone!

I have a column inside a table that I wrote this function for: Count({<isComplete = {'0'}>} 

If  isComplete = 0, then my process is not comple. If isComplete = 1, then my process is  complete.

I am trying to alternate between "1" and "0" in my table to show certain fields. 

Is there a way to create a funtion (more like a toggle button) in the table to alternate between the two?

3 Replies
anthonyj
Creator III
Creator III

Hi @Midastouch365 ,

If you're looking for a button that will change your measure you can create a variable with a default value of "1" and then a standard button with an IF condition that changes the value of this variable between 1 and 0 when pushed.

So first down the bottom left in page edit mode you'll see a button X=.

Enter a variable in here and call it something like vToggle. Define it as a 1 (one);

Next, go to your charts and add a button to your page and in the properties panel at the top right choose Add Action >> Set Variable Value.

In the variable drop down menu you should be able to see the variable you created (vToggle)

In the value function add the following condition that will change your initial value of 1 to a 0 and back again.

=if( $(vToggle) = 1, 0, 1)

To give the toggle button title some context you can add a condition to the button to prompt the action required.

Under General >> Label

=if( $(vToggle) = 1, 'Show Incomplete', 'Show Complete')

Now, in your set analysis you can add the following code

Count({<isComplete = {"$(vToggle)"}>} ID)

I hope this helps.

Thanks

Anthony

Midastouch365
Contributor II
Contributor II
Author

Hi @anthonyj,

I don't see a button in the charts section. How do I get the button feature?

anthonyj
Creator III
Creator III

Hi @Midastouch365 ,

Sorry I haven't had a chance to get on in a while. The button is in the standard visualisations but it was added a few upgrades ago. If it's not there your version might be an older one.

anthonyj_0-1638315432853.png