Do not want to email if there are no records
Do not want to email if there are no records
(OP)
I have a dilemma that I'm not sure how to resolve. I want to send up a recurring report that will email out a report if a payment has been made that day for a vendor. I know how to write the report but I don't want to send a blank report out if no payments were made that day. Does anyone out there know how to prevent the email from being sent if there is no data to report?
Regards,
Bessebo
Regards,
Bessebo
RE: Do not want to email if there are no records
In your report header, place a formula which will only cause an error when the report is empty. Like:
If IsNull(Count({Table.ID}))
Then 1/0
Else 1/1
Suppress the formula and stick it anywhere in your report.
You will have to be careful, of course, that you do not overlook genuine failures which return something other than Division by Zero errors.
Naith
RE: Do not want to email if there are no records
Does the field {Table.ID} refer to a system field that I am unaware of or is this supposed to refer to a field within my data schema? Or should I be able to use it verbatum as you wrote it?
The formula that you wrote was
If IsNull(Count({Table.ID}))
Then 1/0
Else 1/1
I assume that as a result of this formula returning 1/0 if there are no records found then it will result in a failed instance?
Regards,
Bessebo
RE: Do not want to email if there are no records
If there is no data, the formula will attempt to exit on 1/0 - which will make the report fail because, as you're aware, you cannot divide an integer by zero.
As the report fails, an email will not be generated.
Naith
RE: Do not want to email if there are no records
Thanks for the suggestion but I just tested what you suggested and an email is generated and a successful instance is generated. If I click on the attachment that is emailed it brings me into the report in the Info Analyzer with a Division by Zero error.
Also, if I go to Seagate Info and double click on the successful instance it give me the following message (too bad I cannot attach a screenshot):
Crystal Smart Viewer
PEEncapsulatePage : Error in formula <NullData>.
If IsNull(Count({armaster.customer_code}))
'
Division by Zero
Does this work in your environment?
Regards,
Bessebo
RE: Do not want to email if there are no records
I am somewhat confused by the fact that you say your desktop generates a "successful" instance despite the fact that when you attempt to view the report, you can see that the instance has unequivocally failed.
Where have you positioned the formula?
Naith
RE: Do not want to email if there are no records
Maybe I should move the formula into the detail section? Any other suggestions would be appreciated.
Regards,
Bessebo
RE: Do not want to email if there are no records
1/Count({armaster.customer_code}) > 0
Naith
RE: Do not want to email if there are no records
I'm a little confused when you say "in the conditional suppression of the Report Header". I moved it into the Report Header and suppressed it. Now it doesn't even generate an error.
Regards,
Bessebo
RE: Do not want to email if there are no records
Thanks,
Bob