Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with Batch File and Reloading the QVW with Post Reload macro

Dear Friends,

In my Qv application ,i am using macro for converting the reports in PDF and i triggered the macro to run after Post reload of the application automatically. When i reload the QV application manually which contains the macro for PDF conversion it's working fine and all the PDF reports are getting stored in the mentioned path but when i run the same QV application using the batch file ,the application is reloading without any issues but the batch file is quitting immediately after the appliation gets reloaded so that the macro process for PDF conversion is not completing so that the PDF reports are not generated and stored in the mentioned path...Is there any command or syntax to make the batch file to wail until the macro for PDF gets over ? Can anybody help me to sort out this problem...?

Regards

Muruganantham S

Qlikview Developer

16 Replies
Anonymous
Not applicable
Author

A possible way:
1. Create a macro that runs on open, and checks a variable (let call it CreatePDF) which it uses as condition. If it is =1, run your PDF macro, and set variable back to 0.
2. In a batch file, use two command lines:
qv.exe /vCreatePDF=0 /r filename.qvw
qv.exe /vCreatePDF= filename.qvw
First line will reload the application and close it. The second line will create the PDFs, no reload.

Anonymous
Not applicable
Author

Another approach is to create a .vbs file that creates an instance of QlikView, loads a document and then runs the vbscript code you want before quitting again. Here's an example on how it could look:

rem ** VBScript **

set test= CreateObject("QlikTech.QlikView")

set newdoc = test.OpenDoc ("C:\ExportCSV.qvw","user","pass")

test.reload

Insert macro code here. Make sure to call any objects using the prefix 'test' since that is the QlikView object.

test.quit

Not applicable
Author

I had a very similar problem, where the macro wouldn't run when it was triggerede by post-reload. The document was reloaded, but the macro didn't work and the batch window (cmd) kept open together with the proces qv.exe

I used the suggestion made in the topic's 1. reply with succes.

Not applicable
Author

You can try to attach the macro function to a button ( call it BU01 for example).

Then in your vbs. after the reload of your document add the line to press your BU01 button:

Here is an example that will load your document then press the button:

Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc (X:\MyQlikviewfile.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.Reload
ActiveDocument.GetSheetObject("BU01").Press

Regards,

Sébastien

Not applicable
Author

Hi Muruganantham S,

I have same problem with reloading

i have implemented send mail application by using information posted on Qlikview forum

and set module security as system access

Thats why its not working for scheduling through batchfile it gives Fail to open Document

Please share , how you have solve this problem of reloading through batch file , of application which is having system access

eagerly waiting for your reply....

Thank you

Rahul

Not applicable
Author

Hi

Is possible to execute this script :

Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc (X:\MyQlikviewfile.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.Reload
ActiveDocument.GetSheetObject("BU01").Press

with "/NoSecurity" option like when you execute by batch ?

(c:\progra~1\qlikview\qv.exe /r /NoSecurity "X:\MyQlikviewfile.qvw")

james
Creator III
Creator III

If i try to run ActiveDocument.GetSheetObject("BU01").Press through Windows Task scheduler, it fails and states "Object Required: 'Active Document'

If i run the VBS script myself, it runs fine..

Any ideas

boorgura
Specialist
Specialist

The problem should be -

Your batch files reloads the app, saves it and closes it even before the macro is triggered.

Try the option to uncheck the Close on completion for the reload status dialog box.

james
Creator III
Creator III

This is my VBS script, and it is not a BAT file

Set MyApp = CreateObject("QlikTech.QlikView")
Set MyDoc = MyApp.OpenDoc ("c:James\.qvw","","")
Set ActiveDocument = MyDoc
ActiveDocument.GetSheetObject("BU1").Press

Set MyDoc = Nothing
MyApp.Quit
Set MyApp = Nothing

Any help is appreciated