Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro get content of variable doesn't work

Hey, 

When I tried to do this:

temp = ActiveDocument.Variables("vTemp").GetContent.String

path = Replace(path,  "{1}", temp)

And I get nothing.

When I declare the variable in the module like this,  it works :

temp = "temp"

path = Replace(path,  "{1}", temp)

The "vTemp" variable declared in the Variable Overview.

What is the problem?

Thanks.

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Are you calling the macro from the script or from the UI?

-Rob

jagan
Luminary Alumni
Luminary Alumni

Hi,

It is not suggested to use macros if you can achieve the same without using the macros.  Always try to avoid macros, some doesn't works in Ajax mode.

Anyway to achieve your requirement use below macro

SUB setVariable()
set v = ActiveDocument.GetVariable("vTemp")
vTempValue = v.GetContent.String
set v = ActiveDocument.GetVariable("path")
v.SetContent Replace(v.GetContent.String, "{1}", vTempValue), true
END SUB

Hope this helps you.

Regards,

Jagan.