Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
Showing results for 
Search instead for 
Did you mean: 
Creator III
Creator III

Error handling in Qlik Sense?

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?

1 Reply

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