Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Qlik Sense load script examples with error variables usage

Does anyone has Qlik Sense load script examples where error variables are used?

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

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?

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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);

 

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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;


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

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);