Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
cheburashka
Contributor III

How to trigger an error in the script?

Hello,


How can I elegantly trigger an error in the script when a condition is not met?

I do not want to exit the script without an error because then I would not get a warning in the Publisher...


,KR Koen

1 Solution

Accepted Solutions
cheburashka
Contributor III

Re: How to trigger an error in the script?

My solution:

IF condition then 
TRACE( Condition is not valid);
SET TriggerError; //This line of code triggers an error
END IF
9 Replies

Re: How to trigger an error in the script?

My preferred technique: use the CRASH; statement. It doesn't exist but it will do what it says...

MVP & Luminary
MVP & Luminary

Re: How to trigger an error in the script?

Maybe something like this:

if condition = false() then

     Load * Resident NotExistingTable;

end if

- Marcus

Partner
Partner

Re: How to trigger an error in the script?

Hi,

IF Condition Not met,

trace 'This condition has not been met!';

Exit script;

else

Continue

Mark

Employee
Employee

Re: How to trigger an error in the script?

You can use any word that is not a command

If 1 <> 0 then

  Die!

endif ;

cheburashka
Contributor III

Re: How to trigger an error in the script?

Will work but not the most elegant one

cheburashka
Contributor III

Re: How to trigger an error in the script?

Thanks for the feedback. But this will not trigger an error in my mgmt console.

cheburashka
Contributor III

Re: How to trigger an error in the script?

Will it find the endif statement?

cheburashka
Contributor III

Re: How to trigger an error in the script?

My solution:

IF condition then 
TRACE( Condition is not valid);
SET TriggerError; //This line of code triggers an error
END IF
atarvfer
New Contributor

Re: How to trigger an error in the script?

That is genial!