Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
montubhardwaj
Specialist
Specialist

Toggle Selection using a single button

Hi All,

I have got this one working by using two buttons. But wanted to know the best possible approach to do this. can we achieve this using one button? Below is the scenario:

I have two reports. With the help of a button, I want to hide one report and activate another report. For example, If report 'A' is open, then on pressing the button, report 'A' should go and report 'B' should open. Similarly, If I press the button again, report 'A' should open and 'B' should hide.

Your suggestion are very much welcome. Thank you!

1 Solution

Accepted Solutions
nathanfurby
Specialist
Specialist

Look at the latest post for how to change button labels as well.

View solution in original post

8 Replies
Anonymous
Not applicable

Not quite sure what you're referring to here with "Report" (QVW document, Sheet or Actual report inside a QV doc?) but it should be fine. You can attach several actions to one button so that it goes through the steps you want.

Miguel_Angel_Baeyens

Hello,

It depends very much on how you hide/show the charts, (I understand that you mean chart -pivot or straight table- for report). But here's one approach, using one variable vShowChart in the conditional (chart properties, Layout, Show) to keep charts hidden and show one or the other. The text of the button is changed as well:

Sub ShowHideChart set vChart = ActiveDocument.Variables("vShowChart") set vBtnText = ActiveDocument.Variables("vButtonText") vChartS = vChart.GetContent.String if vChartS = "A" then vBtnText.SetContent "Show A Chart", true vChart.SetContent "B", true else vBtnText.SetContent "Show B Chart", true vChart.SetContent "A", true end ifEnd Sub


Hope that helps.

montubhardwaj
Specialist
Specialist
Author

Thank you guys....!!

@Johannes: by report I meant the "Objects" and basically I am reffering to chart objects. So can you please help me in achieving this.

@Miguel: Thanks much bud. But I wanted to achieve this using Actions/Triggers only. I dont want to write any MAcros for this. Is it possible?

Many thx for your responses.

nathanfurby
Specialist
Specialist

Take a look at this post for an example of how to use just variables and not macro code:

http://community.qlik.com/forums/t/43788.aspx

nathanfurby
Specialist
Specialist

Look at the latest post for how to change button labels as well.

Anonymous
Not applicable

Hi Sharma,

Yeah, in that case you might want to go with Nathan's solution using variables and Show Conditions for the objects that you want to hide/show.

Miguel_Angel_Baeyens

Hello,

Of course, just take the set variable action instead of the run macro in the External type of action in the button. The thing is that it's a conditional behaviour (show B and hide A).

The variable vButtonText shows the caption of the button. In the button, create a new action, External, Set Variable, and select vButtonText variable and set the following as Value.

=If(vButtonText = 'Show B Chart', 'Show A Chart', 'Show B Chart')


Add a new action, External, Set Variable, but use now vShowChart as variable and the following as value:

=If(vShowChart = 'A', 'B', 'A')


"A" and "B" are the values used in the Layout tab of the chart properties to show each of the charts.

Hope that helps.

montubhardwaj
Specialist
Specialist
Author

Thank to all of you. Thanks for your time and awsome ideas !!Yes