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.
jduenyas
Contributor III

A challenge

I have a challenge:

I wish to automatically print a pdf document that will be then emailed using another process/application to our sales force. (For the interested, the 'other application' we use is TaskCentre.)

The printout should be run after the last reload of the day. (our server is set to reload every 30 minutes and the last reload is at 11:30 PM)

I have set some script that is triggered after OnPostReload. The trigger activates a macro that checks if the time is after 11:30 PM. If yes, it calls another macro/function which prints the report using Acrobat Distiller and saves it in a prescribed location.

When reloading manually, the process runs like a charm. Reloads>OnPostReload trigger is fired and the report is printed out nicely.

Here is the challenge:

According to QlikView Reference Manual it is impossible to trigger OnPostReload action from a server's load process (Book II Part III 29.3.)

So I thought that I could start my local application remotely (from a VBA calling a shell process) Doing so with the appropriate command line flags the application can be started:

Dim a

a = Shell("C:\Program Files\QlikView\qv.exe /NoSecurity /R C:\MyApplication.qvw")

("/NoSecurity" bypasses the need to confirm start with macros and "/R" tells the application start with a reload)

All works well. The application starts in the background, the load starts and finishes but the printout does not occur.

Does anyone know why or is there a better way to achieve what I am trying to do.

Thanks to all

6 Replies
danielrozental
Honored Contributor II

A challenge

Sure there's a better way, buy QlikView Publisher and PDF Report Distribution.

jduenyas
Contributor III

A challenge

Thank you Daniel.

I was not aware of the product and could not find any references to it in QlikView.com.

Can it be set to run on schedule or does it still need human intervention? We have many such automatic processes that are generated mainly by TaskCentre but the one I described cannot be done by this application

danielrozental
Honored Contributor II

A challenge

Yes, it can be done automatically without any human intervention.

Not applicable

Re: A challenge

Hi,

Macros set to trigger on PostReload event will not be triggered when you reload via batch file but will be run when it is manual.

So after the reloead completed via batch file, you can have a VBS file that can open the QVW application which is just reloaded and access a button which calls the macro and press the button using the syntax

rem ** press button BU01 **

ActiveDocument.GetSheetObject("BU01").Press

Then it will able to trigger the macro.

Cheers.

Not applicable

Re: A challenge

Hi,

I thougt of attaching some sample as well.

Just after you reload the application run this batch file as well.

So this bat file will let you open the application, and on open triggers a macro which will activate the sheet2. and closes the doc as well.

But you mey need to copy your code of epxorting the charts in this macro.

Cheers.

jduenyas
Contributor III

Re: A challenge

Lovely!

Thank you. I knew there's got to be a way via code.

VB is king!

Josh

Community Browser