Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
cheburashka
Creator III
Creator 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
Creator III
Creator III
Author

My solution:

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

View solution in original post

10 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

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

marcus_sommer

Maybe something like this:

if condition = false() then

     Load * Resident NotExistingTable;

end if

- Marcus

Mark_Little
Luminary
Luminary

Hi,

IF Condition Not met,

trace 'This condition has not been met!';

Exit script;

else

Continue

Mark

Clever_Anjos
Employee
Employee

You can use any word that is not a command

If 1 <> 0 then

  Die!

endif ;

cheburashka
Creator III
Creator III
Author

Will work but not the most elegant one

cheburashka
Creator III
Creator III
Author

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

cheburashka
Creator III
Creator III
Author

Will it find the endif statement?

cheburashka
Creator III
Creator III
Author

My solution:

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

That is genial!