Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
its_anandrjs

Export to excel fail some time.

Dear Folks,

I have one Qlik file on that explaining you all one by one

1. Binary Reading of another Qlik file for data model.

2. One Document Event trigger >> On Post Reload

     1.1. By this filters date field is filter with current month.

     1.2. Two Macros running.

Issue Facing:-

1. This Qlik file is running by the Windows bat file on which all this above steps covers but by bat file this macros some time not running and do not create the Excel files.

2. But the same Qlik file is running well if we run it manually and all the two macros run for excel file and properly created.

What is the cause behind this can you all please suggest on this.

Did some one experience the same if so please share the thoughts.

Regards

Anand

6 Replies
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

The windows bat file (QV.exe /r) should work well.

Where I have had issues with this in the past is that if it does stop, for whatever reason, it doesn't exit cleanly and it doesn't notify of the problem.  What's more, if you have a windows scheduler task it can stop the subsequent task running.

I would recommend creating a separate task to monitor the age of the output file, that then alerts if the file has got too stale (you could do this in QlikView using the FileTime function).

Looking at why it has failed, the most likely reason is with the writing of the output file.  Specifically, if you are exporting to Excel and someone has the output file open then the write will fail as the file is locked.  An approach to this would be to put a suffix on each file created, so there is no overwrite.  You would then just have to clear down redundant files later - I don't know if that is an option?

Hope that helps.

Steve

its_anandrjs
Author

Thanks Steve,

For give time on this i agree with you on this but again with manually it works (QV.exe /r) well.

Here is my Bat file code

BAT FILE CODE:-

Del D:\SDATA\Sdata.xlsx

"C:\Program Files\QlikView\Qv.exe" /l D:\APP\SDataApp.qvw"



Here with you i attached two Macro code as well as, please have a look and let me know how we can prompt message from this code.


Regards

Anand

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Without having an application to try this in and an environment set up as your own I can't really test this.

You need to ensure that nothing appears on the screen, particularly a dialog box with an OK prompt as this will stall things.

Wrapping the call in some VBSScript may allow you to ensure the environment is ready before calling QV.

As you are calling macro code you could look at calling the QlikView API from a VBScript file to do the export, but this is not something I have had a need to try myself.

Sorry I can't be of more help at this time.


Steve

its_anandrjs
Author

Dear Steve,

Please have a look at the attached QVW file, and it seems excel object is not call by the Task Scheduler but manually it calls and excel created.

This line:-

Set excelFile = CreateObject("Excel.Application")

Regards

Anand

xyz1
Creator III
Creator III

.

its_anandrjs
Author

Did you mention about the Internet browser History or Explorer Settings.

Regards,

Anand