Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

shamsh01
New Contributor II

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
shamsh01
New Contributor II

Re: Qlik Sense load script examples with error variables usage

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

 

2 Replies

Re: Qlik Sense load script examples with error variables usage

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
shamsh01
New Contributor II

Re: Qlik Sense load script examples with error variables usage

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

 

Community Browser