Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Use of variables in macros

I have added a variable called "AverageOfCountry" using "Variable Overview>Add" from Layout. I defined the variable using an expression. How can I evaluate the expression linked to the variable and use it in a macro? I have to use it in a macro because I need the said variable's value on every sheet of the excel document I'm exporting to.

1 Solution

Accepted Solutions
Highlighted
Partner
Partner

ActiveDocument.GetVariable("AverageOfCountry").getContent.string


and make sure ur variable begins with "=" when created

View solution in original post

9 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Maybe with something like:

v = ActiveDocument.Variables("AverageOfCountry").GetContent.String

- Marcus

Highlighted
Employee
Employee

this will retrieve your variable value

ActiveDocument.GetVariable("AverageOfCountry").GetContent.String

Highlighted
Creator II
Creator II

Well it pastes me the expression string in the Excel table, not the value I would get by evaluating the expression. How do I get the variable expression to evaluate?

Highlighted
Partner
Partner

so set the variable with "=" in front of the expression that the value is calculated.

Regards

Highlighted
Partner
Partner

ActiveDocument.GetVariable("AverageOfCountry").getContent.string


and make sure ur variable begins with "=" when created

View solution in original post

Highlighted
Employee
Employee

Use "=" at beginning of your variable

Highlighted
MVP & Luminary
MVP & Luminary

Another way might be to use evaluate() for the variable or maybe the expression itself - maybe like this: Re: How to export formula with Set analysis using macro

- Marcus

Highlighted
Creator II
Creator II

that's it. Thank you!

Highlighted
Creator II
Creator II

Dear all, 

i have a similar requirement, am using a macro to export my tables into txt format and want to keep prefix as current date to that generated txt files 

i used below F:\Document\$(vDate)_wang.txt  --- and it is getting named as it it, it is not picking the current date, Please help me. Thanks much