Qlik Community

Ask a Question

Community Corner

Discussion board for questions about the Qlik Community, its features, sharing information, general discussions and even some fun. This is for both new and longtime community members. Everyone is welcome!

Announcements
Talk to Experts Tuesday, January 26th at 10AM EST: Qlik Sense. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help understanding macro syntax?

Thanks for taking your time to look at my questions and I hope you can help me with this.

I have the following Macro, and I'm new to macros, what I want is send a report by mail, I found this online, but it doesn't work so I'm trying to understand how it works.

My questions are the following:

1- What's the difference between " set VariableName = Value" and "VariableName = Value"?

Sub PrintRpt()

        'print the report and get the reponse back in a variable

  set printResponse=ActiveDocument.PrintReportEx("RP01")

   'get the name of the PDF file created by the print action above

  sURL=mid(printResponse.URL,3)


        'get the email address of the recipient selected in the recipients listbox

  set recipient=ActiveDocument.fields("Recipient").GetSelectedValues

  set email=recipient.Item(0)


       'set the concatenated string (email address and name of the PDF file) as content of the listbox created in step 4

  ActiveDocument.Variables("vPdfName2").SetContent chr(39) & email.text & ";" & sURL & chr(39), true

   'set the path of the folder in which the text file will be crated

  sFile="C:\_QVW\PDFfolder\WatchThis\email_" & replace(sURL,".pdf","") & ".txt"


       'Export the content of the listbox into a text file that contains the email address and name of the PDF file

  set lb = ActiveDocument.GetSheetObject("LB05")

  lb.ServerSideExportEx sFile , ";" , 1 '0=HTML, 1=Text, 2=Bitmap, 3=XML, 4=QVD, 5=BIFF

End Sub


1 Solution

Accepted Solutions
Specialist III
Specialist III

Hi Luis,

You use set when you are creating an instance of an object.

The variable there becomes a instance of an object in your case it is ActiveDocument.PrintReportEx("RP01")

While creating the instance you have passed the value RP01 which is the ID of the Report.

Objects have properties, methods and events

Next you are using printResponse.URL

URL is a property of an object here and you are reading the value of the property.

On the other hand when you do not use set its just a simplae variable to store the value.

Hope this helps.

Thanks,

Rajesh Vaswani

View solution in original post

2 Replies
Specialist III
Specialist III

Hi Luis,

You use set when you are creating an instance of an object.

The variable there becomes a instance of an object in your case it is ActiveDocument.PrintReportEx("RP01")

While creating the instance you have passed the value RP01 which is the ID of the Report.

Objects have properties, methods and events

Next you are using printResponse.URL

URL is a property of an object here and you are reading the value of the property.

On the other hand when you do not use set its just a simplae variable to store the value.

Hope this helps.

Thanks,

Rajesh Vaswani

View solution in original post

Champion
Champion

Hii

Rajesh do you have Qlikivew Web embedding  Examples how to call qlikview and dashboard in ASP .Net

Awaiting Your Valuable feedback.

Thanks

Vikas