Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do not want to email if there are no records 1

Status
Not open for further replies.

bessebo

IS-IT--Management
Jan 19, 2001
766
0
0
US
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
 
The only way I you can achieve this is to force your report to fail over when 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
 
Naith,
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

 
Generally, if a poster makes a vague reference in curly brackets like {Table.ID}, it's because we don't know what your appropriate field from your schema should be. The idea is that you would replace it with the most important field in your report.

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
 
Naith,
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
 
I don't operate a SI environment anymore, but I have used this in the past, and I know it works.

I am somewhat confused by the fact that you say your desktop generates a &quot;successful&quot; 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
 
I put the formula in the header and suppressed it by using the format editor on the common tab I checked Suppress. I assume you meant that and not Suppress if Zero on the Number tab of the format editor.

Maybe I should move the formula into the detail section? Any other suggestions would be appreciated.

Regards,
Bessebo
 
Try removing that formula and placing this in the conditional suppression of the Report Header:

1/Count({armaster.customer_code}) > 0

Naith
 
Naith,
I'm a little confused when you say &quot;in the conditional suppression of the Report Header&quot;. I moved it into the Report Header and suppressed it. Now it doesn't even generate an error.

Regards,
Bessebo

 
I put the formula you gave me in the first X+2 button under the Format Section (next to Suppress No Drill Down) for the Report Header. Hopefully that was the correct place. It still runs successfully. Still no luck...

Thanks,
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top