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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to change document variable via a macro?

How do I change the value of a document level variable via a JScript Macro?

I found out how to do it via VBScript ie.

function ThresholdSet()
ActiveDocument.Variables("MainCCYear").SetContent "=MainCCDay*22*12",true
end function

But I need to convert it to JScript.

1 Solution

Accepted Solutions
biester
Specialist
Specialist

function ThresholdSet() {
var v = ActiveDocument.GetVariable("MainCCYear");
v.SetContent("=MainCCDay*22*12",true);
}

Rgds,
Joachim

View solution in original post

3 Replies
biester
Specialist
Specialist

function ThresholdSet() {
var v = ActiveDocument.GetVariable("MainCCYear");
v.SetContent("=MainCCDay*22*12",true);
}

Rgds,
Joachim

Not applicable
Author

Thanks, that worked like a charm.

But is there any reason you used a variable, ie. v , as opposed to just doing

ActiveDocument.Variables(



"MainCCYear").SetContent ("=MainCCDay*22*12",true); ?

Best Regards

Dieter

biester
Specialist
Specialist

It's just for better readability, and in case you need the object later it's shorter then always having to use "ActiveDocument.GetVariable...."

Rgds,
Joachim