Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
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
MVP & Luminary
MVP & Luminary

Error in macro

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

Highlighted
philbishop
Contributor

Error in macro

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




Not applicable

Re: Error in macro

Hi I really appreciate the tip.

For days trying how to read varaibles within a macro.

Thanks