Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is there a function to do something like IF ERROR DO NEXT rather than stopping the script and the load failing? If my database (SAP-BW) returns an empty data set then Qlik will fail with an error, rather than recognising "no data - nothing to do".
More detail:
I have a looped load statement that loops through each year sequentially, and then each month within each year;
For vYear = 2010 to 2015
For vMonth = 1 to 12
LOAD <do Stuff here>
Next vMonth
Next vYear
But for the current year there is no data after August and the script fails and no data is loaded (the message is something like "didn't understand reply from database connector".)
I can add a test to say;
If (vYear >= Year(TODAY) , if (vMonth > Month(Today) , next vMonth))
But that seems rather inelegant (and I can't promise there won't be interim months with no data). I'd like to simply add a test which says "IF ERROR NEXT vMONTH" but obviously the error won't be detected until after that months has been processed.
Any ideas?
You can use error variables to assist you:
This is just an example, you'll likely need to look for another error code, see:
set ErrorMode=0;
LOAD * from abc.qvf;
if ScriptError=8 then
exit script;
//no file;
end if