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: 
paputzback
Contributor III
Contributor III

How do you handle reloads that return no results

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

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

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;

View solution in original post

7 Replies
petter
Partner - Champion III
Partner - Champion III

You can use the function NoOfRows ('tablename')

and check for 0.

Gysbert_Wassenaar

Perhaps this video from QlikCentral helps:


talk is cheap, supply exceeds demand
petter
Partner - Champion III
Partner - Champion III

For example like this:

Customers:

LOAD

     *;

SQL

     SELECT

          *

     FROM

          Customers;

Exit Script When NoOfRows('Customers') = 0;

paputzback
Contributor III
Contributor III
Author

So a force exit of the script throws an error?

petter
Partner - Champion III
Partner - Champion III

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;

petter
Partner - Champion III
Partner - Champion III

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...

Hemantx
Contributor
Contributor

this doesn't work right? The sleep is highlighted in red