Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Throw error based on Database field value

Dear All,

is it possible to load a table according to a database filed value. ie, if the value of that field is zero then it should throw error,else it should run the script.

Raise Error based on DB value

Load

Value

From Xtable;

if value=0,then fail script

8 Replies
chiru_thota
Specialist
Specialist

You can do that. Logic here you will check a condition before running script.

To control this you need to put actual code in the form of sub routines. You can have as many sub routines you want.

Just see attached QVW.

LOAD * INLINE [
CheckValue
1
]
;

Let VEXITCOUNT=Peek('CheckValue',0,'Exit_loop_table');
exit script when VEXITCOUNT = 0; 

IF  VEXITCOUNT > 0 then  

Call CodeScript;

END IF;

Not applicable
Author

Hi,

Thank you for your reply, it was very much helpful , will it be possible to throw an error message when that condition not satisfied or else the script execution should be cancelled.

Thanks in advance.

tresesco
MVP
MVP

You can try using Exit Script command conditionally, something like:

If( <condition>) Then

Exit Script;

End If

chiru_thota
Specialist
Specialist

ok.

I guess you will be running this task from QEMC once the development is completed.

Then where do you want to see the message  while QEMC running the QVW?

maxgro
MVP
MVP

replace 1=1 with your condition for error check

set ErrorMode=2;

IF (1=1) THEN

  load * Resident TableNotExists;

ENDIF;

you'll get a in qlik desktop

1.png

on a server you can config to send an alert mail

Not applicable
Author

hi,

kindly post me a sample application.

Thanks..

Not applicable
Author

hi,

in my application after successful reload it will generate a PDF and send mail using publisher .so my concern is like if the condition doesn't satisfies it wont run the script, it would show error message otherwise it will generate a PDF.

Thankss...

Not applicable
Author

Its easy, write an if else statement. If value is 0, ask it to look for file which will never exist. Then the job obviously fails. Use QMEC to send an email if it fails.

Suraj