Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

quriouss
Contributor 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
Employee
Employee

Re: Error handling in Qlik Sense?

You can use error variables to assist you:

http://help.qlik.com/sense/2.0/en-US/online/#../Subsystems/Hub/Content/Scripting/ErrorVariables/Erro...

This is just an example, you'll likely need to look for another error code, see:

http://help.qlik.com/sense/2.0/en-US/online/#../Subsystems/Hub/Content/Scripting/ErrorVariables/Scri...

set ErrorMode=0;

LOAD * from abc.qvf;

if ScriptError=8 then

exit script;

//no file;

end if

Community Browser