Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
inigoelv
Contributor

Export Report PDFCreator by loop

Hello everybody:

I am using the next macro to print automatically one report for diferents suppliers:

Sub ReportPrint 

     Set soc = ActiveDocument.Fields("Supplier Description") 

     Set socPossible = soc.GetPossibleValues 

     For i = 0 to socPossible.Count-1 

          soc.Select socPossible.Item(i).Text 

          ActiveDocument.GetApplication.WaitForIdle 

          ActiveDocument.PrintDocReport "RP05", "PDFCreator" 

     Next 

End Sub 

The macro works very good, but I would like to complete it, inserting the name of every pdf automatically with the combination of three fields: "Supplier Description";"Year" and the Last "Month".

Thanks in advance.

2 Replies
Not applicable

Re: Export Report PDFCreator by loop

Hi Iñigo,

You can create an object type PDFCreator and configure the PDF filename like this:

- Get the field values for "Year" and the Last "Month" as you are already doing for "Supplier Description"

- Create a string variable for the report filename (ex. Dim sPDFName) and stuff it with the desired field values (ex. sPDFName = ReportName & " - " & FieldValue)

- In the PDF object type, configure the  item  .cOption("AutosaveFilename") = sPDFName

Like the code below:

Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")

With pdfjob

      If .cStart("/NoProcessingAtStartup") = False Then

         If .cStart("/NoProcessingAtStartup", True) = False Then

               Exit Sub

         End if

         .cVisible = True

      End If

      .cOption("UseAutosave") = 1

      .cOption("UseAutosaveDirectory") = 1

      .cOption("AutosaveDirectory") = sPDFPath

      .cOption("AutosaveFilename") = sPDFName

      .cOption("AutosaveFormat") = 0 ' 0 = PDF

      .cClearCache

    End With

I got this from Qlik Tips: Qlik Tips: Printing Reports to PDF using PDFCreator

Regards,

Marina C.

sebastiandperei
Valued Contributor

Re: Export Report PDFCreator by loop

Iñigo, If it was useful, why don't you mark as answered?

Community Browser