Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Highlighted
richard_chilvers
Contributor III

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

Re: On Off Switch

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

6 Replies

Re: On Off Switch

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

jsaradhi
Valued Contributor

Re: On Off Switch

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.

Re: On Off Switch

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
Esteemed Contributor

Re: On Off Switch

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
Contributor III

Re: On Off Switch

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.

jsaradhi
Valued Contributor

Re: On Off Switch

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

Community Browser