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

Script for Report Run and email 1

Status
Not open for further replies.

spicysudhi

Programmer
Nov 10, 2003
575
FR
hi

I am looking for the script to run the reports (both Powerplay and Impromptu) on a scheduled basis and email it in a specific format (HTML, PDF, CSV...etc).

can anyone please give me the script.

thanks,

sudhi
 
Sudhi,
You can find sample scripts to run the reports and save them both in the sample folders installed with Impromptu and PowerPlay and in the Macro Help file . Further can be found on the Cognos KB.

For emailing, the script will be determined by your email appliaction - search this forum for 'email'.

For scheduling, you can either use a batch file to call the macro application and file or use the cognos scheduler.

HTH,
lex
---
Here's a few examples from macros I have:
(Objects and variables defined earlier)

Set objImpRep = objImpApp.OpenReport_("k:\reports\lastinvoice.imr")
Set objImpRep = objImpApp.ActiveDocument
objImpRep.RetrieveAll
objImpRep.ExportExcelWithFormat strfiledest
Set objHTML = objImpRep.PublishHTML
objHTML.TOC = 0
objHTML.Publish "k:\html\LastInvoices","LastInvoices"
objImpRep.CloseReport
objImpApp.Quit
...
Set objPPRep = CreateObject("CognosPowerPlay.Report")
objPPRep.Open "K:\PPreports\dailysales.PPR"
objPPRep.Publish "K:\html\Sales" 'HTML format
objPPRep.SaveAs "K:\xl\dailysales",4 'Excel
objPPRep.Close
...
Set objOutlookEmail = CreateObject("CDONTS.NewMail")
'CDO mail setttings for SMTP
with objOutlookEmail
.From = "Cognos@lexco.com"
.To = strTo
.cc = "administrator@lexco.com"
.Subject = strSubject
.Body = strprompt
.MailFormat = 0
.AttachFile strfile
.Send
End with
set objOutlookEmail = nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top