Knowledge Base

Welcome to The Carlisle Group's Knowledge Base.

Search or Ask a Question

This is a keyword search that looks for matching articles that contain one or more words specifically by a user in articles’ tags, title and content. Admin writes brief intro content here via admin end. If you are unable to find an answer to your issue, please submit an issue here.

Back to Articles List

Sample Script - Email a report in the message body. | CAS 6.0

Added: 07/26/2016; Last Modified: 07/26/2016; Visits:742

This sample script will email a HTML report in the body of a message.


⍝⍝ Description = Email a CAS report as HTML
⍝⍝ Written By  = The Carlisle Group.
⍝⍝ CAS         = 6.0

⍝ Get the current CAS file.

⍝ Set a temporary report file path.

⍝ Get the CAS report item.
 OB←CS.GetItem'\CAS Items\Table Report\Main Sample'

⍝ Run the report to HTML
 R←CS.RunCASReport OB'HTML' 0

⍝ Save the HTML to a temporary file.
 R.SaveAs TempFilePath

⍝ Read the report file and convert to a single string.
 TF←TextFile.New TempFilePath

⍝ Setup a new Mail object
 M.Subject←'Hi there'

⍝ It's important to set the HTML flag to 1.
⍝ If not, the data won't be formatted properly.

⍝ Initiate the send.