John Gillen
asked on
Blank Crystal report when no records are found
I'm using Crystal 11 and the crystal server. I'm generating an exception report and emailing the report to the users. The issue is there a way to suppress the actually creation of the report if no records are found? I've checked the suppress printing if no records found in the report options, but the server still sends a empty report to the user.
Thanks
Thanks
ASKER
This report is transaction and time based. It is scheduled to run every 15 minutes and in theory the users would be happy to not receive any emails for a given day. They do not want to get an email stating that all is well, only when there are problems. I was able to get something like this working using alerts, but then the user wanted to format the alert to make it more readable. It appears that all I can do with alert messages is create a single line string, so that did not help.
The users do not want to have to click on a link to the report and then have to login to the server to see the report.
The users do not want to have to click on a link to the report and then have to login to the server to see the report.
OK - one option is to create a formula that will cause the report to fail if there's no data. A common formula would be one that divides one value by another, forcing a division by zero error when there are no records. Ex:
Count({table.field1})/Coun t({table.f ield2})
If there are no records, then the report should fail with a division by zero error. Make sure you don't have the report scheduled to rerun if it fails. Also, make sure you don't have failure notification turned on for this particular report. If the report fails, it won't be emailed.
~Kurt
Count({table.field1})/Coun
If there are no records, then the report should fail with a division by zero error. Make sure you don't have the report scheduled to rerun if it fails. Also, make sure you don't have failure notification turned on for this particular report. If the report fails, it won't be emailed.
~Kurt
ASKER
Yes this will work. I can understand Crystal not wanting their program to come to a sucessful conclusion with no output, that would make the end users crazy.
Thanks
Thanks
ASKER
I have tried the division by zero approach using the Count function. What appears to be happening is when there are no records present the Count funtion returns a null value not zero as the report does not fail with a divide by zero error.
You're right - I remember doing this for Seagate Info, but the more recent versions of CR are 'too intelligent' to allow you to deliberately force an error. The only alternative I can see is to base the report on a stored procedure. The stored procedure would be written to return a valid recordset when there is data, but return an invalid recordset when there isn't any data. The invalid recordset will cause the report to fail when it is scheduled.
~Kurt
~Kurt
ASKER
I was able to get around this with global variables and some formulas. I set a variable to 0 if the IsNull(Count{field1})) was true and this setup a divide by zero error in the report footer section and a subsequent report failure and no email. Not very eloquent, but funtional in this case. The stored procedure approach would work as well.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
~Kurt