Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to fail?

Hello,

Is there a good way (apart from deliberate faulty code) to make a script execution fail?

E. g., when some checking condtion is not met.

("exit script" is not what I want, since it merely exits without failing)

Tags (1)
1 Solution

Accepted Solutions
krishna_2644
Valued Contributor III

Re: How to fail?

See attached.

(Not sure if you need that.)

7 Replies
crystles
Contributor III

Re: How to fail?

If you just want the script to fail, leave off the end of load statement symbol = ;

I know I've done it before... on accident usually though.

MVP
MVP

Re: How to fail?

No AFAIK.

There isn't a raise, exception or similar thing in Qlik to jump to an outer script section.

Actually, I don't see a reason you can't use a "deliberate faulty code" (example load from notexists.qvd) to make a script execution fail. Can you explain a little more in detail?

Not applicable

Re: How to fail?

can you please explain what you are trying to do?

If you set a condition tht will nexver be met, such as your example, that does not make the script fail since it is chedking a condition that is not met -

Not applicable

Re: How to fail?

please see the attached thread - it may be of some help

How can I intentionally create a script error?

krishna_2644
Valued Contributor III

Re: How to fail?

See attached.

(Not sure if you need that.)

chaudhariv
New Contributor II

Re: How to fail?

You can use the

SET ErrorMode= 0;

ErrorMode takes 0,1,2 and other values depending on your requirement.

Not applicable

Re: How to fail?

Thanks all for useful answers! The conjuntion of the answers this far answers my question - I can use ErrorMode=2, and then intentionally write faulty code such as load * from bozofilename.qvd.

One of use of this is that in QMC i can have other tasks have different triggers depending so that some are triggered on the first ones success and others on failure in a more controlled manner.

Community Browser