Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi. How can I raise an exception if I have a "0 lines fetched" during any point in the reload task?
2016-11-30 08:00:06 0104 FROM [myDatabase].[dbo].[myTransactionsTable]
2016-11-30 08:00:06 0105 WHERE TranType IN (
2016-11-30 08:00:06 0106 'buy'
2016-11-30 08:00:06 0107 ,'sell'
2016-11-30 08:00:06 0108 )
2016-11-30 08:00:06 0109 AND InvCode NOT LIKE '%collateral%'
2016-11-30 08:00:06 0110
2016-11-30 08:00:06 0111 ORDER BY TDate DESC
2016-11-30 08:00:07 30 fields found: *** OMITTED FOR BREVITY ***
2016-11-30 08:00:07 0 lines fetched
The only way to raise an exception is to introduce an intentional syntax error like this:
IF NoOfRows('TableName')=0 THEN
Failing due to no rows;
ENDIF
The "Failing due to no rows" is an invalid statement, but it will nicely show as the error cause as well.
-Rob
Hi Khoa, the function NoOfRows('TableName') returns the number of rows, you can check if it's equal to zero.
How do I then raise an exception? Thus marking reload task as failure?
Hi Khoa, you can finish the reload with "Exit Script;" Is this what you want?
You can use it like:
Exit script when NoOfRows('TableName')=0
or:
IF NoOfRows('TableName')=0 THEN
Exit Script;
ENDIF
Would Exit Script; cause the task to end in failure in QMC? Because this is what I want. I need an easy way to, at a glance, tell fail from success of my tasks.
The only way to raise an exception is to introduce an intentional syntax error like this:
IF NoOfRows('TableName')=0 THEN
Failing due to no rows;
ENDIF
The "Failing due to no rows" is an invalid statement, but it will nicely show as the error cause as well.
-Rob