How to raise or throw an error in QlikView or Sense

Sometimes you need to stop your LOAD script if some conditions are not met and raise a custom exception error (for example, required files are not found). You will also want to show a user friendly error message so it is clear why process was stopped and record the error in the application log.

Unfortunately there is no command for that but you can emulate this behavior. I stumbled upon a post by Johan Kristenson and really liked this idea.

In my case, my load script would check for presence of required files on company FTP site and stop the script with a custom error message "Required files not found on FTP".

IF NOT condition THEN  
    CALL ThrowError ('Required file $(vFileName) not found on FTP');
END IF;  

CALL ThrowError calls a non-existing SP to throw a custom error message. The error message will be recorded in a log and the script execution will stop. Pretty neat!

Boris Tyukin

BI, Data Warehousing and ETL

Orlando, Florida