Skip to main content

CreateCustomReport

Structure

CreateCustomReport(sReportName, sEMailTo, sEMailSubject, sEMailBody, sSQL, sTableForUpdate, sFieldForUpdate, sWhereForUpdate, sPrintTo, sFileName: String)

Parameters

ParameterTypeDescription
sReportNameStringthe name of the CUSTOM report that should be created - as created in PrintBuilder...Custom Reports
sEMailToStringaddresses that should receive the email, semi-colon delimited
sEMailSubjectStringsubject for email
sEMailBodyStringemail body, can include carriage returns by using Chr(13) symbol
sSQLStringthis 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.
sTableForUpdateStringonly used if updating database
sFieldForUpdateStringonly used if updating database, the blob field where the resulting report should be attached after creation
sWhereForUpdateStringthe WHERE clause that should be used against the table/field above, to save to the correct record. Begin the text with "WHERE "
sPrintToStringthe destination for the report. Possible values are: PDF, XLS, JPG, RTF, TXT, PRINTER, SCREEN
sFileNameStringcan 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.

Description

This procedure creates an IndySoft Custom report. 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
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")

See also

No related topics