Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

batch or macro to print report into pdf and e-mail or store on file server

Hi,

This might be questioned before, but what I've found on the forum was all quite complex. There must be an easy way to do it (I hope).

Our customer does not have the budget for QV-publisher or a lot of consultancy hours. They run QV server 9 SP6 and have 5 clients.

What they want is to send various reports in .pdf format to various groups of people by either e-mail (preferred) or by placing it on a network share.

I'm looking for a QV macro or a script outside QV to do this automatically. Preferably in a windows scheduler.

Hope to hear from you!

Johan Vermeulen

K3 Business Solutions

Netherlands

10 Replies
Not applicable
Author

I also need same .. And also the configration to be done on the QlikView for the mailing

Not applicable
Author

Anyone have an idea how to manage this?
Thanks in advance.

Not applicable
Author

I managed to do so far:

1) create a windows batch file to start qlikview with a parameter (vPrintReports)

call "C:\Program Files\QlikView\Qv.exe" /vvPrintReports=1 /NoSecurity "C:\Docs\_docs k3l\software\AddOn\External Addons\Qlikview\K3 Dashboards\K3 Retail v6 NL v3.0 SQL Retail.qvw"

2) When QV client is started the parameter is checked (onOpen Trigger) in a vbs macro. If value = 1 then continue macro

sub ReportCheck
set var = ActiveDocument.Variables("vPrintReports")

val = var.GetContent.String

if val = 1 then
call CreateReports
var.SetContent 0, true
'activedocument.closedoc
ActiveDocument.ClearAll (false)
ActiveDocument.GetApplication.Quit
end if
End Sub

3) CreateReports: I created a table in excel with the report ID's to be printed to .pdf. Please install the latest QVPdf printer. You have to set the right preferences in the printer like the folder and the denial of 'do you want to overwrite' messages.

sub CreateReports

set Reporttable = ActiveDocument.GetSheetObject( "TB01" )

for RowIter = 1 to Reporttable.GetRowCount-1
ActiveDocument.ClearAll (false)
reportID = (Reporttable.GetCell(RowIter,0).text)
tempFolder = (Reporttable.GetCell(RowIter,1).text)
set rep = ActiveDocument.GetReport(reportID)
reportName = rep.Name
'Create the file name with path
reportFile = tempFolder & "\" & reportName & " " & Date &" "&hour(Time) &Minute(Time) &second(Time)&".pdf"
printReportPDF reportID, reportFile
next
end sub

4) The file generated is renamed and copied to the correct folder:

function printReportPDF(oReport, pdfOutputFile)

ActiveDocument.PrintReport oReport, "PDF-XChange 3.0",false
ActiveDocument.GetApplication.Sleep 5000

set WSHShell = nothing

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "C:\Docs\QlikView Printing.pdf" , pdfOutputFile
ActiveDocument.GetApplication.Sleep 5000

end function

Now what we need to add is to pick up the file and mail it out. I'm waiting for instructions from my customer whether they'll use an Outlook client or direcdtly through the exchange server. Any suggestion from the forum is welcome.



suniljain
Master
Master

if you have qlikview publisher then you can distribute reports in pdf to user.

Not applicable
Author

Thanks Sunil for the input, however as written in the initial posting, the customer does not have budget voor the publisher.

Cheers,

Johan.

Not applicable
Author

Dear All

Can you attach the QVW file for this report printing ad mailing the report ... Because i was trying it but unable to do it ...

Please ..

Rishi Beri

Not applicable
Author

Hi Johan/Gordan/Paul,

Appreciate your efforts regarding the post, please share the sample qvw file for the same.
My requirement is same where I have to generate pdf and mail the report dealerwise.

I have a common report template for dealers.
Please find the attached file for the report template.
How can I generate the same report dealerwise based on their data? seperate report for each dealer.

Thanks,

Not applicable
Author

You can take a look to DocumentBurster as a lightweight and configurable report bursting and report distribution alternative.

gauravkhare
Creator II
Creator II

Hi there,

First o all let me make this thing very clear that we need have publisher license in order to distraibut or to generate reports in pdf format.YOu have got a number of replies and I very much agree to those. I have implemented automated mailing of pdf reports before.The only thing that you require is qlikview pdf setup. I will be mailing you the complete coding which is in visual basic to your mail id.

Kindly drop a test mail on gaurav.khare03@gmail.com

Regards

Gaurav