Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Requirement
load data with batch file , and batch file should return failure and success status either in the form of files either failure.txt or success.txt
thank you in advance.
Regards
Kamal
I don't think this option will work.
You could do something like this in a batch file:
"C:\Program Files\QlikView\qv.exe" /r "C:\Dev\MyApp.qvw"
IF ERRORLEVEL 0 Goto Success
:Failure
Echo 2>Failure.txt
:Success
Echo 2>Success.txt
HOWEVER, in my experience, the problem with this approach is that if you receive an error, a Script Error dialog box will appear and wait for a user to click the OK or Cancel button (which I do not believe there is a switch for silent mode). Of course, you can suppress errors by adding the SET errormode=0; in your load statement, but the result will be that QlikView will always return a 0 (success) which is not what you want.
Kamal,
Need a better description of what you are attempting to accomplish here. Publisher will create a Task log for every task run, and you can also get a Document/Script log as well if you set the Generate Logfile parameter in the Developer client. The developers have the ability to use the ErrorMode variable in the script as well as some other system variables to capture if there were errors, which might be something you could use here, but again, I am not quite following what you are trying to do from where.
You can use command line to launch tasks, but this requires some changes to the Distribution Service exe.config etc., and you lose some of the functionality of using Publisher via the GUI when doing this, so there are some caveats as well. This is documented in the QlikView Server Reference Manual, just search on 'batch' and you should get the hit you need to change the config file to enable the command line call.
Another option would be to use the QV.exe /r doc.qvw command line to do the reload. You will find information on this in the QlikView Reference Manual, Chapter 7 Starting QlikView. Sorry if this is not what you were looking for, but if you can expand your requirements further in relation to the product, I may be able to provide a better answer at that point.
Regards,
Brett
Hi Brett,
thank you for all help. I am looking for the last option use the QV.exe /r doc.qvw command line to do the reload.
I want to implement this through .bat file that i can schedule with windows scheduler later.
. with this .bat file I want to track whether load was successful or failure . if load was successful then create a success.txt file on disk, in case of failure create failure.txt file
Kamal
Hey Kamal,
I do not believe you are going to be able to get any codes from QlikView back via the batch program, just the Windows Return Codes from Task Scheduler, but what you could do is generate the QlikView logfile on the reload, and then use a text parser to search the log for Execution Finished, which is going to be successful load, anything else should trigger an error message somehow. That is about the best of which I can think to try to do this. I know the Distribution Service does have some return codes which can be used in conjunction with EDX trigger monitoring, but I am not aware of anything on the QV.exe side. Hopefully this may help somewhat.
Regards,
Brett
I don't think this option will work.
You could do something like this in a batch file:
"C:\Program Files\QlikView\qv.exe" /r "C:\Dev\MyApp.qvw"
IF ERRORLEVEL 0 Goto Success
:Failure
Echo 2>Failure.txt
:Success
Echo 2>Success.txt
HOWEVER, in my experience, the problem with this approach is that if you receive an error, a Script Error dialog box will appear and wait for a user to click the OK or Cancel button (which I do not believe there is a switch for silent mode). Of course, you can suppress errors by adding the SET errormode=0; in your load statement, but the result will be that QlikView will always return a 0 (success) which is not what you want.
Hey guys,
Great idea Lior, but error should not hang things when running in 'batch' mode, so I am a little surprised by your experience. The only thing I have seen hang batch calls is if the account being used to run the batch file is not a licensed user of the Developer Client in which case what happens is QlikView does prompt for license info, which of course given batch mode, nobody is going to see etc. Hopefully this may help get things working exactly as you wish Kamal, but again, be sure the account you use to run the Windows Scheduled Task is licensed to the QlikView Client, or things will definitely hang on you.
Regards,
Brett
Hello Brett:
You are correct that an error should not hang things when running in batch mode. The problem is that QV.exe will return a 0 (non-error return code) regardless if it encounters an error in the load script or not when in batch mode, and in return the batch script will pick up the 0 return code and create a success.txt file. I believe Kamal would prefer that QV.exe runs without a hiccup, but returns a non-zero when an error is encountered so that the batch script can write a failure.txt.
~Lior
Hi Kamal,
One idea is to create an alertmail within the qvw, so when a condition is "meet" it will send an email to you.
Hello,
Thank you for the answer.
I've managed to get ERRORLEVEL response from my batch script but I wonder it is possible to get the QV's actual error result when reloading the dashboards from batch files?
Thanks!