Focal Point
Sending an email with the output file only when the file has any data in it

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2171028331

January 20, 2005, 03:36 PM
<geetha>
Sending an email with the output file only when the file has any data in it
Hi,

I just want to see if it is possible or not.

I want to schedule a job in Report Caster which will run a fex and send an email with the file attachment, only if the file has any data in it.

I mean, only send an email when the output file has data in it otherwise don't send an email.

Waiting for the responses.

Thank you,
January 20, 2005, 04:11 PM
<Pietro De Santis>
You can set up a "Pre-Process" fex that determines if there is data for the report, if there is no data, set the &&KILL_RPC variable.

Check the ReportCaster Development and Administration manual.

The &&KILL_RPC flag is a ReportCaster amper variable that you can use in a pre-processing procedure when you want to stop ReportCaster processing and not execute the scheduled procedure based on a condition. The condition may be the existence of a data extract, or a restriction on the days that schedules are allowed to run. The code to evaluate the condition can be a combination of Dialogue Manager and FOCUS supported by the WebFOCUS Reporting Server. The &&KILL_RPC amper variable must be set using Dialogue Manager.
January 20, 2005, 04:21 PM
<geetha>
How about creating an Alert. I was just going through the manual and looks like creating an alert would be a good thing for that. The manual only tells the procedure how to create the alert, no example code to go through. I have to play with it and see how it works.

Would someone post the sample code of how to create an alert
January 20, 2005, 04:53 PM
TexasStingray
An Alert uses a pre-processing procedure that if it the main procedure should not run issues a

-SET &KILL_RPC = 'Y';

otherwise the main report will run.

either way the next run time will be updated
January 20, 2005, 06:31 PM
susannah
easier....
Do your Fex in 2 steps.
1) create the exact hold file from which the report would be created.
2) test the &LINES variable for value
if &LINES EQ 0 GOTO ENDOFJOB;
3) table file hold
write your nice report

This is easy and works like a charm. I do it 8zillion times a day. If there is no data, the fex bypasses the nice fancy html report generator; If there is no html output, the RC log will show NO REPORT TO DISTRIBUTE and nothing goes to anybody.
ok ok...it was 3 steps. Wink