Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
The #1 reason QlikView customers adopt Qlik Sense is a desire for a modern BI experience. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Error in macro


sub StocksActivate
set f=ActiveDocument.Fields("inv")
set sv=f.GetSelectedValues
f.Select "(25|30|43)"
end sub

sub StocksDeactivate
set f=ActiveDocument.Fields("inv")
f.SelectValues sv
end sub


I create two subs for Page Triggers (first to Activate, second to Deactivate trigger). Main idea was to store current selection before activating page to sv variable, and restore it after deactivation. In sub Deactivate a get an error - "Type mismatch: 'f.SelectValues'"

Any ideas?

3 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Is sv declared as a global VB variable? From what you posted, it will be set in StocksActivate but not available to StocksDeactivate.

Highlighted
Creator
Creator

You can add the following code to your macro to access the content of a variable in the qv document.



rem ** Get setting of variable **
set vT = ActiveDocument.GetVariable("vTest")
rem ** Get value of variable **
SelValue = vT.GetContent.String
rem ** Select data **
ActiveDocument.Fields("inv").Select SelValue




Highlighted
Not applicable

Hi I really appreciate the tip.

For days trying how to read varaibles within a macro.

Thanks