Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

macro execution does not work after reloading through scheduler in QV 11

Hi,

I have written a macro to create pdf after reloading is done.

This works fine if the report is reloaded through QV Desktop.

but when the same report is reloaded through QV server using scheduler, reloading works fine but pdf does not get generated.

This is the macro I have written in Edit module and have triggered it on PostReload.

sub PrintReport

ActiveDocument.GetApplication.Sleep 2000

ActiveDocument.PrintReport "RP01", "PDF-Xchange 4.0", false ' This line of code pops up save as dlg

ActiveDocument.GetApplication.Sleep 10000

end sub

ea

12 Replies
jerrysvensson
Partner - Specialist II
Partner - Specialist II

Macros doesn't work in Publisher.

You need to run it as a Supporting task / External program.

Not applicable
Author

How to create supporting task /External Program?

How to call it after reloading?

I have QV 11 and No Publisher.

Please reply fast as I need to complete this today.

magavi_framsteg
Partner - Creator III
Partner - Creator III

External Tasks is only avaiable when using Publisher.

Instead, schedule a .cmd/.bat-file which executes qv.exe /r <path\filename.qvw>.

Only qv.exe will trigger OnPostReload-events, NOT Publisher.

Kind regards

Magnus Åvitsland

BI Consultant

Framsteg Business Intelligence Corp.

Not applicable
Author

Hi Magnus,

How to schedule .bat file? using QV scheduler?

if yes how and if no then also how?

Not applicable
Author

Hi Magnus,

I did try to create the .bat file but when executing the macro, it gets hung.

If I disable the postreload trigger the .bat file works fine.

what can be the reason?

magavi_framsteg
Partner - Creator III
Partner - Creator III

Hi again.

What happens if you logon to the server on which qlikview publisher runs with the same user that runs the publisher service.

And then open your document with qv.exe (standard QlikView) and do a manual reload?

Does that work?

ActiveDocument.PrintReport "RP01", "PDF-Xchange 4.0", false ' This line of code pops up save as dlg

The macro cannot answer YES on the prompt for "save as", so you could try and delete the PDF first if it already exists, and then print the new PDF.

Hope this helps.

Kind regards

Magnus Åvitsland

BI Consultant

Framsteg Business Intelligence Corp.

Not applicable
Author

Hi Magnus,

I do not have Qlikview Publisher.

But when I run the report manually, It will create the PDF.

I have bypassed the saveas dialog. So it will not ask for path and filename. It will drectly create the PDF.

When I reload the report through QV server, it reloads the report but do not create the pdf.

I also did try by deleting the old pdf and reloaded through QV server. But stlll no PDF.

So I am asking how to schedule the .bat file and why does it hung it when macro is included.

magavi_framsteg
Partner - Creator III
Partner - Creator III

Hi Apu.

OK.

- When you do it manually;

  Do you reload it using the same user which runs the "QlikView Server" service?

  Log on to Windows using that user OR run qv.exe as that user.

- When QlikView Server does the reload;

  Does it execute the rest of the macro code?

Kind regards

Magnus Åvitsland

BI Consultant

Framsteg Business Intelligence Corp.

Not applicable
Author

Hello All,

I used windows batch file to create the PDF and its working fine now.

Thanks for everyone's help.