Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Accessing parameters in URL

Does anyone have a working example of how to read parameters from a url. I have seen several posts with code like the below but it isn't working for me. I have the below code on the OnOpen event.

The url: http://us5076webd/QvPlugin/opendoc.htm?document=AP%20Published/test.qvw?F1=5



sub SelectDefaultSettings

set

end

sub myCurrency = ActiveDocument.GetVariable("F1").GetContent. String
set ActiveDocument.Field("F1"). Select myCurrency



Can anyone help?

Thanks

Labels (1)
3 Replies
rwunderlich
MVP
MVP

Is F1 predefined in the document? You must predefine variables to be able to receive them as parameters.

-Rob

Not applicable
Author

I have modified my code because initially I had F1 as a field and variable. I changed it to :





set myVar = ActiveDocument.Variables("Var1").GetContent.String
set TgtCurr = ActiveDocument.GetField("F1")
TgtCurr.Select myVar

Under Settings Variable Overview, I added variables for both myVar and Var1.

When I run the above, I get:

Macro parse failed. Functionality was lost
SelectDefaultSettings
Error: Object required: '[string: "2"]'

Any other ideas?



rwunderlich
MVP
MVP

Remove "set" from "set myVar....".

Set is only used when the function returns a type of Object.

-Rob