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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
herard_bertrand
Partner - Creator
Partner - Creator

Qlik Sense script, is it possible to manually exit script with errors

Hello,

In Qlik Sense, in the load script. If a result of a variable is wrong, i'd like to interrupt the Script.

It's easy to interrupt the script : I use a if then else, and an EXIT SCRIPT; when I need to.

But is there a way to EXIT SCRIPT as an error ? I mean, when I do an EXIT SCRIPT, the reload stops, but in schedulers the reload appears as a successfull reload. Is there a way to exit script as a failed reload ? 

(I'm looking equivalent to exit code = 1) 

Thanks 
Best Regards  

Labels (2)
3 Solutions

Accepted Solutions
Or
MVP
MVP

@herard_bertrand  Had a look at doing this in Cloud, this should work:

IF 1=1 then

Load * from NotReal.qvd;

End if

View solution in original post

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @herard_bertrand 


Alternatively if you dont like the alert just do something like this: 

IF zVariable = 'Wrong value' then 

Load * From [lib://ThisDoesntExist/FailHere.Qvd](qvd); 

End if; 

Regards Jandre

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

View solution in original post

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can do it like this to avoid any syntax flags:

Set vFail=;
IF 1=1 then
  Set vFail = 'Fail here!';
End If
$(vFail)

-Rob

View solution in original post

8 Replies
JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @herard_bertrand 

I have had this as well - just do something like this. 

IF zVariable = 'Wrong value' then 

fail here;

End if; 

"The word fail here is just in text so this will cause the application to fail" So in the script it looks like this 

JandreKillianRIC_0-1743067118951.png

 

Regards Jandre

 

 

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

herard_bertrand
Partner - Creator
Partner - Creator
Author

That's an interesting workaround. 

I'm just not a fan of the constant alert of the syntax check, but it works 😉

thanks

Or
MVP
MVP

*Presenter voice* Then you're just going to love our new... quotes!

IF 1=1 then

'fail here';

End if;

 

I also do not like the alert. 🙂

herard_bertrand
Partner - Creator
Partner - Creator
Author

Heu... thanks but I still have the alert 😉 (I'm working on Qlik Cloud not On Premise maybe this is a difference) 

Or
MVP
MVP

@herard_bertrand  Had a look at doing this in Cloud, this should work:

IF 1=1 then

Load * from NotReal.qvd;

End if

JandreKillianRIC
Partner Ambassador
Partner Ambassador

Hi @herard_bertrand 


Alternatively if you dont like the alert just do something like this: 

IF zVariable = 'Wrong value' then 

Load * From [lib://ThisDoesntExist/FailHere.Qvd](qvd); 

End if; 

Regards Jandre

Mark the solution as accepted that solved your problem and if you found it useful, press the like button! Check out my YouTube Channel | Follow me on LinkedIn

herard_bertrand
Partner - Creator
Partner - Creator
Author

OK, it will due,

Thanks

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can do it like this to avoid any syntax flags:

Set vFail=;
IF 1=1 then
  Set vFail = 'Fail here!';
End If
$(vFail)

-Rob