Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Schedule reload with.bat

Hello everyone,

Because I have some trouble with scheduled reload on QMC, i would like to schedule a reload with a bat file (and then using Windows task sheduler).

The thing is I have dependant tasks. 4 applications must be reloaded one after another.

So far, I have just writen

"C:\\Program Files\Qlikview\Qv.exe" /r "\\blabla\App_1.qvw"

"C:\\Program Files\Qlikview\Qv.exe" /r "\\blabla\App_2.qvw"

"C:\\Program Files\Qlikview\Qv.exe" /r "\\blabla\App_3.qvw"

"C:\\Program Files\Qlikview\Qv.exe" /r "\\blabla\App_4.qvw"


But even if one fails, the following one are reloaded and I don't want that.


How can I specify that I want to stop the execution of the bat file  if one task fails ?

Thanks for your help

15 Replies
Not applicable
Author

Hi Massimo,

You mean create a special application to reload the 4 other ones ?

If so, how do I write in the script "reload" app1 ?

And then I guess I don't need a variable with a status because a Qlikview reload always stops when an there is an error ?

Thanks

marcus_sommer

If the update-logic per server worked fine unless proper mails for failure/success it could be an alternativelly to use this functionality and take a second independent batch-line which checks the updates (filetime) and send the mails.

Then all methods have disadvantages and require a lot of effort to recognize and handle them, for example my preferred method with open + reload per vbs in a batch-qvw will stop by any error and hang if a ftp-server or a database didn't response. All error-methods to handle these cases didn't work well so that I really need a second etl-line which checked the first line and closed them by any error/timeout and started the first line again by skipping the previous update-tasks. For me it was too much effort and so I live with some shortcomings ...

- Marcus

Not applicable
Author

Hello everyone,

I have managed to do it using Erica's solution :

EG:

Rem *** Check the logfile for errors by doing a string search
type "BatchExample_loading.qvw.log" | findstr /I /C:"Error:"

Rem ***if the text "Error" is found, output to a file, othrwise some other action
if %errorlevel%==0 (
echo %date% %time% Error occurred - Log lines found are: >ErrorDetails.txt
type "BatchExample_loading.qvw.log" | findstr /I /C:"Error:">>ErrorDetails.txt

) else (

[another action!]

......

Now I face another problem. I have tested it with an application which fails.  The thing is with my .bat, Qlikview opens up and performs the reload and when there is an error in the script, a pop up appears  (for example : table not found) and then, I have to manually click on "Ok" so the batch can continue... Otherwise, it stays like this..

And if I have a sheduled task at 01:00 that fails and another task at 02:00, the second one cannot start because the first one is "blocked"  (and the app1 is opened).

What can I do about that ?

thanks again for your help

Not applicable
Author

Hi Laura

Set the system variable  errormode to 0 in the script in your QVW

ErrorMode = 0;

This will continue the script if an error is found wihtout having to click on any dialogues.

Erica

Not applicable
Author

Thank you Erica !

I have another problem. I cannot find the proper syntax for the if, else ....

I have :

if %errorlevel%==0 (

Code to send email

)

else

([

"C:\\Program Files\Qlikview\Qv.exe" /r "Referentiel\Referentiel_MAITRE.qvw"

])

If my first application fails, I receive an email and then the batch stops so it's okay.

But if my first application doesn't fail, I don't receive an email (which is ok) but  the second application (in the else) doesn't start reloading...

I have also tried :

if %errorlevel%==0 ; then

Code_email

else

"C:\\Program Files\Qlikview\Qv.exe" /r "\Referentiel\Referentiel_MAITRE.qvw"

fi

This time the second app starts but I always receive an email (even if there is no error in the first app)

Does someone see what's wrong in my piece of code ?

Thanks again.

Laura

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

I think the last part of your code should look like this:

if %errorlevel%==0 (

Code to send email

) else (

"C:\Program Files\Qlikview\Qv.exe" /r "Referentiel\Referentiel_MAITRE.qvw"

)

Note the line breaks with the else statement

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein