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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Emailing Reports from APS

Status
Not open for further replies.

jocago

Programmer
Sep 23, 2003
6
0
0
US
Does anyone have a solution for emailing in the body of an email reports that are output from an APS? I have a director who wants to see a report on his Blackberry at scheduled intervals.

I had considered creating a JAVA or VB app that looks for a .txt output from the APS and, when found, parses it into SMTP. That just seems like such a radical solution for what someone else may have already encountered and solved.

Any suggestions?
 
By "see it on his blackberry I hope that you aren't suggesting anything unbefitting of civilized people..."

I guess emailing in the body of a report means that you want to be able to email to different people based on some field in some section of the report, perhaps based on a condition?

Try using technical terms to describe the intent.

There is a 3rd party report viewer with email "bursting":


-k
 
Maybe I should start over.

I am scheduling a report to run on an APS server for output at several times per day. My director is frequently off-site, so I need to send reports to him on his blackberry (a wireless palm-top). The blackberry cannot handle attachments, so I need to send the contents of the report via the body of an email to him. The address will remain static, but the contents of the report, obviously, will not.
 
Jocago,
You we need to create an UFL or buy one. I testing this using the below code and it worked. The UFL will need to be registered on the server as well as an Development PC you use.

Mark


Public Function SendMailOutlook(sTo As String, sSubject As String, _
sTextBody As String, sFrom As String) As String

'Create an Outlook object
Dim Outlook As New Outlook.Application
Set Outlook = CreateObject("Outlook.Application")

'Create e new message
Dim Message As Outlook.MailItem
Set Message = Outlook.CreateItem(olMailItem)

'You can display the message To debug And see state
'.Display

Message.Subject = sSubject
'Message.Body = sTextBody
Message.HTMLBody = sTextBody
'Set destination email address
Message.Recipients.Add (sTo)

'Set sender address If specified.
Const olOriginator = 0
If Len(sFrom) > 0 Then
Message.Recipients.Add(sFrom).Type = olOriginator

'Send the message
Message.Send

End If
Set Outlook = Nothing
End Function
 
I had the same requirement some time ago and elected to use the database (SQL Server) to do this by sending along the results of a query.

Neither Info nor CE allows you to insert the report within the body of the email, you have to send it as an attachment.

Mark's solution looks intriguing, though there's a good deal left to do there.

-k
 
Synapsevampire,

I create a formula that is at the end or report footer of a report. In the formula I setup my UFL with the information that has been gathered as the report is processing. Than when the report is processing the footer my UFL runs, sending me totals that the report compiled.
It does not send me the whole report, just a few totals that I want daily in my Inbox/email.

I could have the report sent to me, but all I want is the totals.

This saves me opening e-mail attachements.

Mark
 
I see, that makes sense if you're only sending totals, but if you want ot send a report, there's a a bit more to do.

Such as exporting the report to a file, and reading the file in as text and inserting that.

Hence the database solution is much cleaner for me, if that is an option.

-k
 
Jocago,

This is the code I use in my formula. As I said I put this formula at the ReportFooter.
Have not tested to see if there is a limit to the sTextBody string, my guess would be yes.

Mark

// start of code
WhilePrintingRecords;
stringVar sTo :="nospam@nospam.com";
stringVar sSubject := "Reconcile for 2003" ;
stringVar sFrom := "kmsalt@nospam.com";
stringVar sTextBody := "";

sTextBody := "The reconciliation report for " + "<B>"+ {?CalendarYear} + "</B>";
sTextBody := sTextBody + "<BR>" + " The Total Pay Amount is " + totext(Sum ({mpdt.contract_pay_amt}));
sTextBody := sTextBody + "<BR>" + " For the Agency = " + "<I>" + {?Agency} + "</I>";
sTextBody := sTextBody + "<BR>" + " Isn't this a cool way to get your data?";
OutlookFDMFunctions (sTo,sSubject ,sTextBody ,sFrom )
//end of code
 
Well, I found a solution, though it's not pretty. I created a VB app that checks a given directory for a .txt file and reads the file. Then it creates a new outlook email (similar to what kmsalt is doing) and outputs the text as the body. Then I created a .txt report in InDe and output to the specified directory.

Thanks for all the suggestions. If anyone needs code for the vb app, I'd be happy to help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top