Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have an app that once in a blue moon one of the scripts doesn't return data. If we re run the app it loads fine. Now I know there is more research to be done on finding out why that is happening. But for right now, I am being told to come up with a solution to notify someone if a table comes back with zero records. FYI, I am the server admin, not the developer. But in my limited knowledge of the application, I would think there would be a way to fail the reload if a script returns zero rows or less than a certain parameter, or have the script email the admins if it returns zero rows. And maybe it could even reschedule itself to run 10 minutes later.
Thanks,
Phil
To also have a wait and retry:
Retries = 0;
DO
Retries = Retries + 1;
Customers:
LOAD
.....;
WHEN NoOfRows('Customers') = 0 AND Retries < 5 SLEEP 600000; // Wait 10 minutes before next retry
LOOP UNTIL Retries = 5 OR NoOfRows('Customers') > 0
EXIT SCRIPT WHEN NoOfRows('Customers') = 0;
You can use the function NoOfRows ('tablename')
and check for 0.
Perhaps this video from QlikCentral helps:
For example like this:
Customers:
LOAD
*;
SQL
SELECT
*
FROM
Customers;
Exit Script When NoOfRows('Customers') = 0;
So a force exit of the script throws an error?
To also have a wait and retry:
Retries = 0;
DO
Retries = Retries + 1;
Customers:
LOAD
.....;
WHEN NoOfRows('Customers') = 0 AND Retries < 5 SLEEP 600000; // Wait 10 minutes before next retry
LOOP UNTIL Retries = 5 OR NoOfRows('Customers') > 0
EXIT SCRIPT WHEN NoOfRows('Customers') = 0;
No it doesn't ... there is no statement to throw an error really... maybe simulating it by doing something that throws an error - a bit ugly but it works...
this doesn't work right? The sleep is highlighted in red