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: 
richard_chilvers
Specialist
Specialist

On Off Switch

I have a table which includes a column which may be hidden based on a condition.

I would like to display an on-off 'switch' to allow the user to optionally show or not show the column.

I'm sure I have seen examples of switches of this type, but any ideas of an elegant solution to this ?

Thanks

Richard

1 Solution

Accepted Solutions
alexandros17
Partner - Champion III
Partner - Champion III

1) define a variable in the script:

LET myVar=0; and reload the script

2) add a button with action -> external -> set variable and write in the upper textbox myVar, in the lower textbox:

=if(myVar=0,1,0)

3) in your column in the visibility section write: myVar=1

Let me know

View solution in original post

6 Replies
MayilVahanan

HI

If you are using QV 11,

Instead of table, use straight table and in dimension tab check enable conditional to hide and show the dimension based on your requirement

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable

you will need a variable...create a variable vToggle and set it to 1.

create a text box or a button and in the action tab, click Add, select Set Variable and input the variable name. in the value you can input

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

in the table, select the expression or dimension and check Enable and Conditional and input vToggle=1 in Conditional field.

alexandros17
Partner - Champion III
Partner - Champion III

1) define a variable in the script:

LET myVar=0; and reload the script

2) add a button with action -> external -> set variable and write in the upper textbox myVar, in the lower textbox:

=if(myVar=0,1,0)

3) in your column in the visibility section write: myVar=1

Let me know

datanibbler
Champion
Champion

Hi Richard,

it would depend on what type of switch you have in mind - but even if I don't think there is something like that already available, you can build almost anything using several textboxes.

richard_chilvers
Specialist
Specialist
Author

The button idea works well for me, thanks !

I can change the colour and text of the button to show whether it is on or off.

Anonymous
Not applicable

glad it worked...but just fyi, you can customize text boxes better than buttons.