CreateCustomReportEMailPreview
Structure
CreateCustomReportEMailPreview(sReportName, sEMailTo, sEMailSubject, sEMailBody, sSQL, sTableForUpdate, sFieldForUpdate, sWhereForUpdate, sPrintTo, sFileName: String; bShowErrors,bShowConfirmation: Boolean)
Parameters
| Parameter | Type | Description
| sReportName | String | the name of the CUSTOM report that should be created - as created in PrintBuilder...Custom ReportssEMailTo | String | addresses that should receive the email, semi-colon delimitedsEMailSubject | String | subject for emailsEMailBody | String | email body, can include carriage returns by using Chr(13) symbolsSQL | String | this optional parameter will cause this sql to be used for the master dataset in the report INSTEAD of the sql in the IndySoft report designer. This only applies to the master dataset (not detail datasets). The report must not use Auto-search fields. It is suggested that the exact sql from the IndySoft report designer is located through DBLog.exe or AppServerLog.exe first, then use this exact sql as a template for how it might be modified in this variable.sTableForUpdate | String | only used if updating databasesFieldForUpdate | String | only used if updating database, the blob field where the resulting report should be attached after creationsWhereForUpdate | String | the WHERE clause that should be used against the table/field above, to save to the correct record. Begin the text with "WHERE "sPrintTo | String | the destination for the report. Possible values are: PDF, XLS, JPG, RTF, TXT, PRINTER, SCREENsFileName | String | can either be the full file name you want to use (if relevant) or the word 'PROMPT' - in which case you are prompted with a dialog for the file name/directory. Any file extension at the end of sFileName is ignored - that is mandated by the sPrintTo variable above. sFileName can be either a directory or a full file name with path.bShowErrors | Boolean | True or False boolean value. If true, any errors found upon email execution are shown to the user through a popup dialogbShowConfirmation | Boolean | True or False boolean value. If true, a confirmation dialog is shown to the user after email is sent. |
Description
This procedure creates an IndySoft Custom report, just like CreateCustomReport. The only difference is this procedure allows for 2 additional parameters of bShowErrors and bShowConfirmation that are helpful when an email preview is desired. The report can be sent as an email if email settings are specified. Report can be created to SCREEN or PRINTER if specified in sPrintTo. The full SQL used for the main data pipeline can also be specified - this will override the default sql in the report. Also, the report can be optionally saved to a blob field in the database.
Example
sDocName = "TESTDOC"
' if saving to db later, first seed the location of the final print job - CreateCustomReport will attach it, based on last 3 parameters
' note that a late trigger action like After Finish - Before Print is appropriate, using LookupFinalEventNum
if not tdDoSQLRecords(1, "SELECT DOC_NUM FROM EVENTDOCS WHERE EVENT_NUM = " & LookupFinalEventNum & " AND DOC_NUM = '" & sDocName & "'") then
RunSQL("INSERT INTO EVENTDOCS (EVENT_NUM, DOC_NUM, DOC_DATE, FILE_NAME, DOC_TYPE, PRINTING_COMPLETE) VALUES (" & LookupFinalEventNum & ", '" &
sDocName & "', '" & FormatDateTimeForSQL(Date) & "', '" & sDocName & ".PDF', '4', '0')")
End If
' email will be previewed before being sent:
CreateCustomReport("EXAMPLE", "eddie@notreal.com;suzie.office@notreal.com", "Here is your report - stop bugging me",
"This is the email body" & Chr(13) & "This is a second line in the email body",
"SELECT GAGES.COMPANY, GAGES.GAGE_SN, GAGES.GAGE_ID, SCHEDGI.SCHED_TYPE, SCHEDGI.SCHED_FREQ, SCHEDGI.SCHED_INTERVAL, SCHEDGI.SCHED_LAST, SCHEDGI.SCHED_DUE_DATE FROM GAGES GAGES " &
"LEFT OUTER JOIN SCHEDGI SCHEDGI ON (SCHEDGI.COMPANY = GAGES.COMPANY) AND (SCHEDGI.GAGE_SN = GAGES.GAGE_SN) WHERE (GAGES.COMPANY = 'ABC COMPANY' AND SCHEDGI.SCHED_TYPE = 'CALIBRATION')",
"EVENTDOCS", "DOC_BLOB", "WHERE EVENT_NUM = " & LookupFinalEventNum & " AND DOC_NUM = '" & sDocName & "'", "PDF", "IndySoftEventReport", True, True)
Application Compatibility
IndySoft Calibration Management, IndySoft Commercial Lab Management, IndySoft Tool Management
Also See
No related topics |