Avoid Scheduling when no data in report
This post is about how to avoid scheduling when there is no data fetched from database. Sometime there is client requirement that they don’t want to receive reports when there is no data.
The only way we could stop scheduling the report when no data, is to make scheduling failed so that it doesn’t send any email to recipients.
We can make scheduling fail when there is a runtime error in the report. So the runtime error considered is 1/0.
Let us consider we have one data provider1 in our report and which gives me results in the report. And for some date there is no data. Below are the steps to make scheduling fail.
- Create a new data provider(Query 1)
- Use Custom Query script and keep the FROM and WHERE clause same as that of “Query 1” script, which is the actual report script. Change the SELECT clause as below :
SELECT 1/count(*)
FROM Query1
WHERE (keep same condition as of Query 1)
- When there will no data from Query1, your count wlll be zero and 1/0 will throw error and scheduling gets failed.
Be the first to leave a comment
You must be Logged on to comment or reply to a post.