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

VB Script

Hi all,

i am having a hard time setting a document variable from a VB script.

Depending on whether a container object (Object5) is visible or not, i want to set the value of a document variable (vPurchaseInterval) to 1 or 0.

I was trying to achieve this via VB - maybe there is a better / easier solution.

Here is what i did (...but this did not work...)

Sub setVariable

          set obj                               = ActiveDocument.GetSheetObject("Object5")

          set status                = ActiveDocument.Variables("vPurchaseInterval")

 

      if obj.IsActive then status.SetContent "1", true else status.SetContent "0", true

 

End Sub

Can anyone help ?

Thanks in advance!

3 Replies
Not applicable
Author

Hello Kali,

Try the below code.

 

Sub setVariable

set obj = ActiveDocument.GetSheetObject("CH01")

set status = ActiveDocument.Variables("vset")

if obj.IsActive then status.SetContent "1", true else status.SetContent "0", true

End Sub

Not applicable
Author

How does this differ from what I tried?

Not applicable
Author

I have added a sample QVW - if the chart "CH01" is active (visible), the value of the var vActive should change to 1, otherwise it should be 0.

Hope someone can help!