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:
Method | Description |
---|---|
CreateOutput(Email as Boolean) as Boolean | Creates 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 String | Returns 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 String | Returns the evaluated footer expression. |
GetReportHeader() as String | Returns 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 Boolean | This 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:
Name | Data Type | Description |
---|---|---|
cAttachments | Character | A comma-separated list of file names to use as additional attachments to the email being sent besides the report. |
cComments | Character | The comments for the report. |
cDataGroup | Character | The data group for the report. |
cCCRecipients | Character | The carbon copy (CC) email addresses to send an email to. |
cBCCRecipients | Character | The blind carbon copy (BCC) email addresses to send an email to. |
cEmailSubject | Character | The subject for the email. |
cEmailBody | Character | The message body for the email. |
cErrorMessage | Character | The text of any error that occurred. |
cFooter | Character | The unevaluated footer expression. |
cHeader | Character | The unevaluated header expression. |
cMergeFrom | Character | The Merge From setting for Microsoft Word merge output. |
cOutput | Character | The type of output for the report: "PREVIEW", "PRINTER", or "FILE". |
cOutputFileName | Character | The name of the file to output to. |
cRecipients | Character | The email addresses to send an email to. |
cReportName | Character | The name of the report. |
cSQLSelect | Character | The custom SQL statement for the report. |
cUserName | Character | The name of the user who created the report. |
lAddGroupToFileName | Boolean | True to add the group value to the file name when outputting each group to a separate email. |
lAdvance | Boolean | True if the report uses an advanced layout. |
lAllowDuplicates | Boolean | True 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. |
lAllowEmptyResultSet | Boolean | True if the Run report with no records option is turned on. |
lAllowFilter | Boolean | True if the Allow report to be filtered option is turned on. |
lAllowSort | Boolean | True if the Allow report to be sorted option is turned on. |
lDisplayFilter | Boolean | True if the Include filter in report header option is turned on. |
lDisplayGridLines | Boolean | True to display grid lines in the spreadsheet; only applicable to Microsoft Excel full format (XLSX and XLSX) and OpenOffice Calc documents. |
lDistinct | Boolean | True if the Add DISTINCT to SQL statement option is set to Yes. |
lEmbedReportInEmail | Boolean | True to embed the report as HTML in the body of the email. |
lEraseFile | Boolean | True to erase the file after the email is sent. |
lForEachMode | Boolean | True if the Output each group as a separate file option is turned on. |
lHaveGroupedFields | Boolean | True if there are any grouped fields in the report. |
lShowTotalsInGroupHeader | Boolean | True if the Show totals in group headers option is turned on. |
lSummary | Boolean | True if the Summary report option is turned on. |
lTimestamp | Boolean | True if the Add timestamp to file name option is turned on. |
nBatchItem | Integer | Which report number this is in a batch report run. |
nEndPage | Numeric | The value the user entered for the End page option. |
nMargin | Numeric | The value the user entered for the Left margin option. |
nMergeType | Numeric | The type of Word merge to do: 1 = letter, 2 = directory |
nOrientation | Numeric | The report orientation: 0 means automatic, 1 means portrait, and 2 means landscape. |
nRecords | Numeric | The number of records in the result set for the report. |
nStartPage | Numeric | The value the user entered for the Start page option. |
oCustomJoins | Object | A 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. |
oFieldsCollection | Object | A 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. |
oOutput | Object | A 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. |
oSortCollection | Object | A 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
Name | Data Type | Description |
---|---|---|
Table1 | Character | The first table in the relationship. |
Table2 | Character | The second table in the relationship. |
JoinType | Character | The join for the relationship as a spelled-out string (e.g. "inner join"). |
Field Object Members
Name | Data Type | Description |
---|---|---|
aCalcFields | Array of Character | An array of aliased field names used to calculate the value of this field if it's a calculated field. |
cAlias | Character | The table the field belongs to. |
cAliasCaption | Character | The caption for the table the field belongs to. |
cCaption | Character | The caption for the field. |
cChartFormat | Character | The format for the field in a chart or gauge. |
cChartInputMask | Character | The picture for the field in a chart or gauge. |
cChartTotalType | Character | The total type for the field in a chart or gauge; see "cTotalType" below for a list of values. |
cComment | Character | The comment for the field. |
cCursorFieldName | Character | The name of the field as it appears in the result set. |
cDatabase | Character | The database the field belongs to. |
cFieldExpr | Character | The 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. |
cFieldName | Character | The aliased name of the field. |
cFieldType | Character | A single character representing the data type of the field:
|
cFontName | Character | The font for this field in the report. This is blank if the default font for the report is used |
cFormat | Character | The format for this field. |
cHeading | Character | The column heading for this field in the report. |
cInputMask | Character | The picture for this field. |
cOther | Character | User-defined information for the field. |
cOutputExpr | Character | The expression to determine the value of this field if it's a calculated field. |
cOutputType | Character | The 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. |
cRoles | Character | A comma-delimited list of roles that can access the field (blank means everyone can access it). |
cTotalType | Character | The 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. |
cUser | Character | User-defined information for the field. |
cVersion | Character | The version number of this field. |
lAllowValueSelection | Boolean | True if the Values button is enabled for this field. |
lAutofit | Boolean | True if the Auto-fit column option is turned on. |
lBookmark | Boolean | True if the Create bookmarks on this field option is turned on. |
lCalculated | Boolean | True if this is a calculated field. |
lExact | Boolean | If 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. |
lFavorite | Boolean | True if this is a "favorite" field. |
lFilterable | Boolean | True if the user can filter on this field. |
lFontBold | Boolean | True if this field is bolded. |
lFontItalic | Boolean | True if this field is italicized. |
lFontUnderline | Boolean | True if this field is underlined. |
lGroupCount | Boolean | True if the Show count in group footer option is turned on. |
lGroupOnOneLine | Boolean | True if the Place all fields in group header on same line option is turned on. |
lNewPage | Boolean | True if the Start each group on a new page option is turned on. |
lNoTotalsForOneRecord | Boolean | True if the No group footer if only one record in group option is turned on. |
lResetPage | Boolean | True if the Reset page number to 1 option is turned on. |
lShowPercent | Boolean | True if the Show percentage of total option is turned on. |
lSortable | Boolean | True if the user can sort on this field. |
lSuppress | Boolean | True if the Suppress repeating values option is turned on. |
lUseDefaultFormat | Boolean | True if the Use default format option is turned on. |
lUseDefaultFormatForChart | Boolean | True if the Use default format option is turned on for this field in a chart or gauge. |
nBackColor | Numeric | The background color for the field. -1 means use the color of the template object. |
nChart | Numeric | The 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). |
nChartOrder | Numeric | The order for this field in the chart. 1 is the first field, 2 the second, and so on. |
nDataTrimming | Numeric | The 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. |
nFieldDec | Numeric | The number of places after the decimal. |
nFieldLen | Numeric | The width of the field. |
nFontAlign | Numeric | The alignment for the field. 0 means left, 1 means right, and 2 means center. |
nFontSize | Numeric | The font size of the field. -1 means use the template font size. |
nForeColor | Numeric | The foreground color for the field. -1 means use the color of the template object. |
nGroup | Numeric | The grouping position for the field: 0 means the field is not grouped, 1 means the first grouped field, and so on. |
nHPosition | Numeric | The horizontal position for the field. -1 means use the next available position. |
nOrder | Numeric | The order for this field in the report. 1 is the first field, 2 the second, and so on. |
nOutputLen | Numeric | The output width of the field. This value is 0 unless it's different than nFieldLen. |
nVPosition | Numeric | The vertical position for the field. -1 means use the next available position. |
nWidth | Numeric | The width of this field in the report. |
Output Object Members
Name | Data Type | Description |
---|---|---|
cClause | Character | The clause to apply to the report run, such as NEXT 10 for the next 10 records. |
cDisplay | Character | The filter description. |
cDelimiter | Character | The delimiter between fields; the default is ",". Only applicable for CSV output. |
cFields | Character | A comma-delimited list of the fields to output. |
cFontName | Character | The name of the font used for output. |
cFooter | Character | The report footer. |
cHeader | Character | The report header. |
cMergeFrom | Character | The name and path of the Microsoft Word document to merge from; only applicable for Word Merge output. |
cOutputFileName | Character | The name of the file to output to. |
cOutputType | Character | The 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. |
cOutputUser | Character | "data" for data-only output, "full" for full format output, or "spreadsheet" for a spreadsheet with an XLS extension. |
cPassword | Character | The password used to encrypt the file (blank means the file isn't encrypted). |
cReportName | Character | The name of the report. |
cUserName | Character | The name of the user running the report. |
dReportDate | Date | The date the report is run. |
lAppendFile | Boolean | True to append the output to an existing file (not supported for all formats). |
lDisplayFilter | Boolean | True if the filter description should be displayed in the header. |
lDisplayGridLines | Boolean | True to display grid lines in the spreadsheet; only applicable to Microsoft Excel full format (XLSX and XLSX) and OpenOffice Calc documents. |
lEmbedFonts | Boolean | True to include the fonts in the file; only applicable to PDF. |
lForEachMode | Boolean | True to output each group to a separate file. |
lIncludeMemoFields | Boolean | True to include memo fields in the output. |
lIncludePercentFields | Boolean | True to include percentage fields in the output. |
lOutputHeadings | Boolean | True to include column headings in the output. Only applicable to CSV and text output. |
lShowGroupCount | Boolean | True to show a group count. |
lSummary | Boolean | True for a summary-only report. |
nFontCharSet | Numeric | The font charset to use. |
nFontSize | Numeric | The font size. |
nFontStyle | Numeric | The font style: 0 = normal, 1 = bold, 2 = italic, 3 = bold and italic |
nMergeType | Numeric | The type of Word merge to perform: 1 = letter, 2 = directory; only applicable for Word Merge output. |
Sort Object Members
Name | Data Type | Description |
---|---|---|
cAlias | Character | The table the field belongs to. |
cCaption | Character | The caption for the field. |
cFieldName | Character | The name of the field. |
lAscending | Boolean | True if the sort is in ascending order or false if descending. |
lGroup | Boolean | True if this field is being grouped on. |
nOrder | Boolean | The sort order for the field in the SQL statement. |
© Keystroke.ca, 2023 • Updated: 03/26/20
Comment or report problem with topic