Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
helen_pip
Creator III
Creator III

Multibox to only appear based on the result of a macro

Dear Qlikview user

I have a 3 buttons and each button has an action on it which runs the same macro.

The buttons control the tabs on a container  I.e. if Button 1 gets clicked, then tab 1 shows in the container.  This is achieved by the following macro:

Sub ActivateTab(I)

for j = 1 to 2

  Set Obj=ActiveDocument.GetSheetObject("Container_" & j)

  Set ObjProp=Obj.GetProperties

  ObjProp.SingleObjectActiveIndex=I

  Obj.SetProperties ObjProp

  next

end Sub

Sub ActivateTab1()

  ActivateTab(1)

end Sub 

Sub ActivateTab2()

  ActivateTab(2)

end Sub 

Sub ActivateTab3()

  ActivateTab(3)

However in addition to all this, I have a multibox which I only want to appear if the user clicks on Button 1 (Which activates tab 1 of the container), but am unsure how to put a conditional show based on the selection of a macro on a multibox

Can anyone help on how I put a conditional show on something based on a macro

Kind Regards

1 Solution

Accepted Solutions
zhadrakas
Specialist II
Specialist II

Hello Helen,

you can set a variable in your macro. Then you can add a conditional show if(vShow=1,1,0) to your multibox

Sub ActivateTab(I)

  for j = 1 to 2

    Set Obj=ActiveDocument.GetSheetObject("Container_" & j)

    Set ObjProp=Obj.GetProperties

    ObjProp.SingleObjectActiveIndex=I

    Obj.SetProperties ObjProp

  next

end Sub

Sub ActivateTab1()

set vShow = ActiveDocument.Variables("vShow")

vShow.SetContent 1 , true

ActivateTab(1)

end Sub

Sub ActivateTab2()

  set vShow = ActiveDocument.Variables("vShow")

  vShow.SetContent 0 , true

  ActivateTab(2)

end Sub

Sub ActivateTab3()

  set vShow = ActiveDocument.Variables("vShow")

  vShow.SetContent 0 , true

  ActivateTab(3)

end sub

regards

tim

View solution in original post

2 Replies
zhadrakas
Specialist II
Specialist II

Hello Helen,

you can set a variable in your macro. Then you can add a conditional show if(vShow=1,1,0) to your multibox

Sub ActivateTab(I)

  for j = 1 to 2

    Set Obj=ActiveDocument.GetSheetObject("Container_" & j)

    Set ObjProp=Obj.GetProperties

    ObjProp.SingleObjectActiveIndex=I

    Obj.SetProperties ObjProp

  next

end Sub

Sub ActivateTab1()

set vShow = ActiveDocument.Variables("vShow")

vShow.SetContent 1 , true

ActivateTab(1)

end Sub

Sub ActivateTab2()

  set vShow = ActiveDocument.Variables("vShow")

  vShow.SetContent 0 , true

  ActivateTab(2)

end Sub

Sub ActivateTab3()

  set vShow = ActiveDocument.Variables("vShow")

  vShow.SetContent 0 , true

  ActivateTab(3)

end sub

regards

tim

helen_pip
Creator III
Creator III
Author

Hi Tim

Thank you for your suggestion. It works for me

Kind Regards

Helen