Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

rustyfishbones
Honored Contributor II

Can you call a Qlikview Variable in a Macro?

Hi All,

I have a Variable called vCustomer

I have a macro that creates a new Qlikview file that I got from the community

SUB createfile

Set Qv = CreateObject("QlikTech.QlikView")

Set docObj = Qv.CreateDoc

docObj.SaveAs "C:\Users\alan\Desktop\$(vCustomer).qvw"

docObj.CloseDoc

Set docObj = Qv.OpenDocEx (qvwFullPath,0,false)

docObj.Save

docObj.CloseDoc

Qv.Quit

END SUB

I tried adding the Variable vCustomer to save the new Qlikview file as the Customer in my project, but it does not work.

Any suggestions

Regards

Alan

4 Replies
jsingh71
Valued Contributor

Re: Can you call a Qlikview Variable in a Macro?

HI Refer this, Hope this will help you

Macro.png

Not applicable

Re: Can you call a Qlikview Variable in a Macro?

I use ActiveDocument.Variables("varname").getcontent.string to get value from the qvw..maybe you can parse that into the saveas command ?

Re: Can you call a Qlikview Variable in a Macro?

set v = ActiveDocument.GetVariable("vWos_Amount")

where vWos_Amount is my variable

Re: Can you call a Qlikview Variable in a Macro?

Just as a side note to the already perfect replies from the others: macros do not have dollarsign-expansion applied to them. $(vVar) only works in QV script and in expressions, code for which the QlikView engine is responsible.

AFAIK macro's are handled by the standard Microsoft VBScript interpreter, that has no idea what $-sign substitution is actually. You'll have to pass through the QV object model to pick up variable values. Various methods to do this are provided in previous replies.

Good luck,

Peter

Community Browser