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

Toggle Button

Hi, 

ive created a toggle button which i want to override selection made in list box and switch between 2 bar charts.

i created a variable(vOverrideVariable):

= if(vOverrideVariable = 0,1,0)

i created a button:

Actions>Set Variable> Variable = vOverrideVariable

in both the bar charts, under Layout> Show>Conditional:

vOverrideVariable=1 for chart1 and vOverrideVariable=0 for chart2

however, when i select the button, the variable definition is disappearing? does anyone have any idea as to how this is possible?

TIA

 

Labels (2)
1 Solution

Accepted Solutions
olivetwist
Creator
Creator

Maybe along the lines of:

IF(vOverideSelection = 1,1,GetFieldSelections(graph_type))

View solution in original post

6 Replies
olivetwist
Creator
Creator

I'm not sure why it is disappearing, but try setting the action like this:

Set Variable > Variable = vOverrideVariable; Value =-$(vOverrideVariable)

And set you charts to:

vOverrideVariable=1 for chart1 and vOverrideVariable=-1 for chart2

jwaligora
Creator II
Creator II

When I toggle, the variable typically doesn't hold the function, just the value itself. The function lives in the Button trigger.  Also, remember to create and initialize the variable to one of its two possible values.

Toggle Setting A:

QV_Sample_8.png

Toggle Setting B:

QV_Sample_9.png

Variable and Button Settings:

QV_Sample_10.png

J.

anonymous1
Contributor III
Contributor III
Author

 thank you everyone for your responses, i now have it working.  although the the graphs will change with the toggle button and no longer with the selection list box, is it possible to allow it to change with both?

olivetwist
Creator
Creator

I'm not following. You want to use a list box selection to show or hide certain graphs? can you give me more info? do you have a field like "graph_type" with values "1,0"?

olivetwist
Creator
Creator

Maybe along the lines of:

IF(vOverideSelection = 1,1,GetFieldSelections(graph_type))

Brett_Bleess
Former Employee
Former Employee

Please be sure to mark any posts that helped you resolve the issue with the Accept as Solution button, and if the other posts did not help, and you solved it yourself, please provide details of what you did to solve it and then mark that post as the solution.  If you still need further help, please provide a further update/information as well.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.