Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Does anyone has Qlik Sense load script examples where error variables are used?
I am trying out below simple script -
xyz:
load * inline [ x,y
1,1];
let vScriptError = ScriptError;
Trace $(vScriptError);
Per the documentation, I expect it to log ‘0’ in the output. It doesn’t though. Any ideas why it's not printing 0?
Thanks for the reply Wassenaar,
If I execute your script with slight modification , Trace does print the error message when an error is there.
set ErrorMode =0;
LOAD * FROM NoSuchTable;
LET vScriptError = 'Errorcode: ' & ScriptError;
Trace $(vScriptError);
Actually per Qlik Sense help , Script Error should return 0 if no error is there.
See this help section on Script Error ScriptError ‒ Qlik Sense
So when there are no errors, then if ScriptError=0 condition works. Problem was when I try to print the value in output. Tony Ventura from Qlik helped me out with this.
I was basically missing '#' in front of the variable. Below will print '0'
load * inline [ x,y
1,1];
let vScriptError = ScriptError;
Trace vScriptError = $(#vScriptError);
If there's no error then the errorcode is empty, not 0.
Try this to see an actual error:
SET ErrorMode = 0;
LOAD * FROM NoSuchTable;
LET vScriptError = 'Errorcode: ' & '$(ScriptError)';
SET ErrorMode = 1;
Thanks for the reply Wassenaar,
If I execute your script with slight modification , Trace does print the error message when an error is there.
set ErrorMode =0;
LOAD * FROM NoSuchTable;
LET vScriptError = 'Errorcode: ' & ScriptError;
Trace $(vScriptError);
Actually per Qlik Sense help , Script Error should return 0 if no error is there.
See this help section on Script Error ScriptError ‒ Qlik Sense
So when there are no errors, then if ScriptError=0 condition works. Problem was when I try to print the value in output. Tony Ventura from Qlik helped me out with this.
I was basically missing '#' in front of the variable. Below will print '0'
load * inline [ x,y
1,1];
let vScriptError = ScriptError;
Trace vScriptError = $(#vScriptError);