Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
It appears QlikSense does not have a simple way to abort the script AND show the run as a failure. I come from a SAS background and in that language, there was a command called ABORT. this would terminate the script and throw an error so it was very obvious the run was a failure. Without this functionality, a scheduled task could terminate early due to an exit script call, but the task status would be success.
I derived a work around solution below, but would love if something like this were native to the qlik script language 🙂
/**********/
/* Abort. */
/**********/
/*
Created: 20190201 - Kenneth Krehbiel
Modified:
This sub is used to terminate a qlik script and intentionally throw an error.
Using exit script alone will kill the script, but not show the run as a failure.
Thus you could easily miss a bad run via the qmc...
Note that the command is a direct ripoff of the SAS command ABORT...
*/
Sub Abort(AbortMessage);
Trace
******************** ERROR! ********************
$(AbortMessage)
Exiting Script...
******************** ERROR! ********************;
intentional error - see message above for details;
Exit Script;
End Sub;
You are correct there is no native exit with error command. Traditionally what we have done is just put the message as a statement, which will be invalid and generate an error.
$(AbortMessage)
or
Terminating due to missing file.
-Rob
Rob,
Thanks for your reply! I like both those methods you provided. Though I still think having an explicit command like ABORT would be a nice feature in some future version of Qlik. Just helps new users if they are familiar with other programming languages.
-Ken