This is an advanced topic intended for programmers.

During the run of a report, a report object named loReport is available. This object has several properties and methods you may find of interest. You can work with this object in any event code you have created for the report; see the Customizing the Report Execution topic for information about report event code.

Here are some methods you may find useful:

MethodDescription
CreateOutput(Email as Boolean) as BooleanCreates a file (if nothing or .F. is passed as the parameter) or emails the report (if .T. as a parameter). Before creating a file, call SetOutputToFile to set the file specifications. Before sending an email, set the cRecipients, cBCCRecipients, cEmailSubject, and cEmailBody properties. This method returns True if it succeeds.
GetReportFilter([SingleLine as Boolean]) as StringReturns the descriptive filter expression for the report. Pass .T. to put each condition on a separate line or .F. (or no parameter) to put all conditions on the same line.
GetReportFooter() as StringReturns the evaluated footer expression.
GetReportHeader() as StringReturns the evaluated header expression, including the filter. Pass .T. to this method to return just the header.
SetOutputToFile(FileName as String [, Type as String [, SubType as String]]) as BooleanThis method is discussed in the Customizing the Report Execution help topic. It sets the output properties of the report based on the parameters passed. Call this before calling CreateOutput. SetOutputToFile returns True if it determines what type of file to create.


Here are some of the more useful properties of this object:

NameData TypeDescription
cAttachmentsCharacterA comma-separated list of file names to use as additional attachments to the email being sent besides the report.
cCommentsCharacterThe comments for the report.
cDataGroupCharacterThe data group for the report.
cCCRecipientsCharacterThe carbon copy (CC) email addresses to send an email to.
cBCCRecipientsCharacterThe blind carbon copy (BCC) email addresses to send an email to.
cEmailSubjectCharacterThe subject for the email.
cEmailBodyCharacterThe message body for the email.
cErrorMessageCharacterThe text of any error that occurred.
cFooterCharacterThe unevaluated footer expression.
cHeaderCharacterThe unevaluated header expression.
cMergeFromCharacterThe Merge From setting for Microsoft Word merge output.
cOutputCharacterThe type of output for the report: "PREVIEW", "PRINTER", or "FILE".
cOutputFileNameCharacterThe name of the file to output to.
cRecipientsCharacterThe email addresses to send an email to.
cReportNameCharacterThe name of the report.
cSQLSelectCharacterThe custom SQL statement for the report.
cUserNameCharacterThe name of the user who created the report.
lAddGroupToFileNameBooleanTrue to add the group value to the file name when outputting each group to a separate email.
lAdvanceBooleanTrue if the report uses an advanced layout.
lAllowDuplicatesBooleanTrue if the Add DISTINCT to SQL statement option is set to something other than When filtering on a table not included in the fields list.
lAllowEmptyResultSetBooleanTrue if the Run report with no records option is turned on.
lAllowFilterBooleanTrue if the Allow report to be filtered option is turned on.
lAllowSortBooleanTrue if the Allow report to be sorted option is turned on.
lDisplayFilterBooleanTrue if the Include filter in report header option is turned on.
lDisplayGridLinesBooleanTrue to display grid lines in the spreadsheet; only applicable to Microsoft Excel full format (XLSX and XLSX) and OpenOffice Calc documents.
lDistinctBooleanTrue if the Add DISTINCT to SQL statement option is set to Yes.
lEmbedReportInEmailBooleanTrue to embed the report as HTML in the body of the email.
lEraseFileBooleanTrue to erase the file after the email is sent.
lForEachModeBooleanTrue if the Output each group as a separate file option is turned on.
lHaveGroupedFieldsBooleanTrue if there are any grouped fields in the report.
lShowTotalsInGroupHeaderBooleanTrue if the Show totals in group headers option is turned on.
lSummaryBooleanTrue if the Summary report option is turned on.
lTimestampBooleanTrue if the Add timestamp to file name option is turned on.
nBatchItemIntegerWhich report number this is in a batch report run.
nEndPageNumericThe value the user entered for the End page option.
nMarginNumericThe value the user entered for the Left margin option.
nMergeTypeNumericThe type of Word merge to do: 1 = letter, 2 = directory
nOrientationNumericThe report orientation: 0 means automatic, 1 means portrait, and 2 means landscape.
nRecordsNumericThe number of records in the result set for the report.
nStartPageNumericThe value the user entered for the Start page option.
oCustomJoinsObjectA reference to a collection of custom joins for the report. The collection has a Count property, indicating how many members there are in the collection, and Add and Remove methods to add and remove members. See the table below for members of this collection.
oFieldsCollectionObjectA reference to the field collection for the report. There is one member in the collection for each field in the report. The collection has a Count property, indicating how many members there are in the collection, and Add and Remove methods to add and remove members. See the table below for members of this collection.
oOutputObjectA reference to the object used to output the report to a file. This object is only valid after the report has been output. One method is useful: CreateFile, which creates the file specified in cOutputFileName. See the table below for members of this collection.
oSortCollectionObjectA reference to the sort collection for the report. There is one member in the collection for each sort field in the report. The collection has a Count property, indicating how many members there are in the collection, and Add and Remove methods to add and remove members. See the table below for members of this collection.

Custom Join Object Members

NameData TypeDescription
Table1CharacterThe first table in the relationship.
Table2CharacterThe second table in the relationship.
JoinTypeCharacterThe join for the relationship as a spelled-out string (e.g. "inner join").

Field Object Members

NameData TypeDescription
aCalcFieldsArray of
Character
An array of aliased field names used to calculate the value of this field if it's a calculated field.
cAliasCharacterThe table the field belongs to.
cAliasCaptionCharacterThe caption for the table the field belongs to.
cCaptionCharacterThe caption for the field.
cChartFormatCharacterThe format for the field in a chart or gauge.
cChartInputMaskCharacterThe picture for the field in a chart or gauge.
cChartTotalTypeCharacterThe total type for the field in a chart or gauge; see "cTotalType" below for a list of values.
cCommentCharacterThe comment for the field.
cCursorFieldNameCharacterThe name of the field as it appears in the result set.
cDatabaseCharacterThe database the field belongs to.
cFieldExprCharacterThe expression for the field. This is normally the same as cFieldName but can be different if the field is an expression to be retrieved from the database engine.
cFieldNameCharacterThe aliased name of the field.
cFieldTypeCharacterA single character representing the data type of the field:
  • W: Blob
  • C: Character
  • Y: Currency
  • D: Date
  • T: Date/Time
  • B: Double
  • G: General
  • I: Integer
  • L: Logical
  • M: Memo
  • N: Numeric
  • V: Varchar
  • Q: Varbinary
cFontNameCharacterThe font for this field in the report. This is blank if the default font for the report is used
cFormatCharacterThe format for this field.
cHeadingCharacterThe column heading for this field in the report.
cInputMaskCharacterThe picture for this field.
cOtherCharacterUser-defined information for the field.
cOutputExprCharacterThe expression to determine the value of this field if it's a calculated field.
cOutputTypeCharacterThe output data type of the field; see "cFieldType" above for a list of valid data types. This value is blank unless it's different than cFieldType.
cRolesCharacterA comma-delimited list of roles that can access the field (blank means everyone can access it).
cTotalTypeCharacterThe totaling for this field. "N" means no totaling, "S" means sum, "C" means count, "A" means average, "L" means lowest, "H" means highest, "D" means standard deviation, and "V" means variance.
cUserCharacterUser-defined information for the field.
cVersionCharacterThe version number of this field.
lAllowValueSelectionBooleanTrue if the Values button is enabled for this field.
lAutofitBooleanTrue if the Auto-fit column option is turned on.
lBookmarkBooleanTrue if the Create bookmarks on this field option is turned on.
lCalculatedBooleanTrue if this is a calculated field.
lExactBooleanIf this property is True and the user filters on this field, adds blanks to the filter value when the "equals" operator is used so the search is exact.
lFavoriteBooleanTrue if this is a "favorite" field.
lFilterableBooleanTrue if the user can filter on this field.
lFontBoldBooleanTrue if this field is bolded.
lFontItalicBooleanTrue if this field is italicized.
lFontUnderlineBooleanTrue if this field is underlined.
lGroupCountBooleanTrue if the Show count in group footer option is turned on.
lGroupOnOneLineBooleanTrue if the Place all fields in group header on same line option is turned on.
lNewPageBooleanTrue if the Start each group on a new page option is turned on.
lNoTotalsForOneRecordBooleanTrue if the No group footer if only one record in group option is turned on.
lResetPageBooleanTrue if the Reset page number to 1 option is turned on.
lShowPercentBooleanTrue if the Show percentage of total option is turned on.
lSortableBooleanTrue if the user can sort on this field.
lSuppressBooleanTrue if the Suppress repeating values option is turned on.
lUseDefaultFormatBooleanTrue if the Use default format option is turned on.
lUseDefaultFormatForChartBooleanTrue if the Use default format option is turned on for this field in a chart or gauge.
nBackColorNumericThe background color for the field. -1 means use the color of the template object.
nChartNumericThe type of field in the chart or gauge. 0 means X axis (chart) or current value (gauge), 1 means Y axis (chart) or goal value (gauge), and 2 means series (chart).
nChartOrderNumericThe order for this field in the chart. 1 is the first field, 2 the second, and so on.
nDataTrimmingNumericThe type of trimming for this field. 0 means default, 1 means trim at the nearest character, 2 means trim at the nearest word, 3 means add an ellipsis at the nearest character, 4 means add an ellipsis at the nearest word, and 5 means add an ellipsis in the middle of the text.
nFieldDecNumericThe number of places after the decimal.
nFieldLenNumericThe width of the field.
nFontAlignNumericThe alignment for the field. 0 means left, 1 means right, and 2 means center.
nFontSizeNumericThe font size of the field. -1 means use the template font size.
nForeColorNumericThe foreground color for the field. -1 means use the color of the template object.
nGroupNumericThe grouping position for the field: 0 means the field is not grouped, 1 means the first grouped field, and so on.
nHPositionNumericThe horizontal position for the field. -1 means use the next available position.
nOrderNumericThe order for this field in the report. 1 is the first field, 2 the second, and so on.
nOutputLenNumericThe output width of the field. This value is 0 unless it's different than nFieldLen.
nVPositionNumericThe vertical position for the field. -1 means use the next available position.
nWidthNumericThe width of this field in the report.

Output Object Members

NameData TypeDescription
cClauseCharacterThe clause to apply to the report run, such as NEXT 10 for the next 10 records.
cDisplayCharacterThe filter description.
cDelimiterCharacterThe delimiter between fields; the default is ",". Only applicable for CSV output.
cFieldsCharacterA comma-delimited list of the fields to output.
cFontNameCharacterThe name of the font used for output.
cFooterCharacterThe report footer.
cHeaderCharacterThe report header.
cMergeFromCharacterThe name and path of the Microsoft Word document to merge from; only applicable for Word Merge output.
cOutputFileNameCharacterThe name of the file to output to.
cOutputTypeCharacterThe type of file to create. For images, the type of image file: "BMP", "GIF", etc. Other valid values: "Native_FDOCX" (Microsoft Word DOCX), "FDOC" (Microsoft Word DOC), "HTML", "FODS" (Open Office spreadsheet), "FODT" (Open Office document), "PDF", "FRTF" (Rich-text format), "XLSPLAIN" (Microsoft Excel XLS), "Native_FXLSX" (Microsoft Excel XLSX), and "XPS". Blank for all other types.
cOutputUserCharacter"data" for data-only output, "full" for full format output, or "spreadsheet" for a spreadsheet with an XLS extension.
cPasswordCharacterThe password used to encrypt the file (blank means the file isn't encrypted).
cReportNameCharacterThe name of the report.
cUserNameCharacterThe name of the user running the report.
dReportDateDateThe date the report is run.
lAppendFileBooleanTrue to append the output to an existing file (not supported for all formats).
lDisplayFilterBooleanTrue if the filter description should be displayed in the header.
lDisplayGridLinesBooleanTrue to display grid lines in the spreadsheet; only applicable to Microsoft Excel full format (XLSX and XLSX) and OpenOffice Calc documents.
lEmbedFontsBooleanTrue to include the fonts in the file; only applicable to PDF.
lForEachModeBooleanTrue to output each group to a separate file.
lIncludeMemoFieldsBooleanTrue to include memo fields in the output.
lIncludePercentFieldsBooleanTrue to include percentage fields in the output.
lOutputHeadingsBooleanTrue to include column headings in the output. Only applicable to CSV and text output.
lShowGroupCountBooleanTrue to show a group count.
lSummaryBooleanTrue for a summary-only report.
nFontCharSetNumericThe font charset to use.
nFontSizeNumericThe font size.
nFontStyleNumericThe font style: 0 = normal, 1 = bold, 2 = italic, 3 = bold and italic
nMergeTypeNumericThe type of Word merge to perform: 1 = letter, 2 = directory; only applicable for Word Merge output.

Sort Object Members

NameData TypeDescription
cAliasCharacterThe table the field belongs to.
cCaptionCharacterThe caption for the field.
cFieldNameCharacterThe name of the field.
lAscendingBooleanTrue if the sort is in ascending order or false if descending.
lGroupBooleanTrue if this field is being grouped on.
nOrderBooleanThe sort order for the field in the SQL statement.

© Stonefield Software Inc., 2024 • Updated: 03/26/20
Comment or report problem with topic