Skip to content

Application Programmer Interface (API)

Every report crafted using DataFlex Reports preserves its definition within a file marked with the .DR extension. This definition is subsequently interpreted by the DataFlex Reports Runtime, embodied in an OCX (Object Linking and Embedding Control). The specific OCX, aptly named 'DataFlex Reports Developer Edition API.ocx,' extends beyond mere representation of a report; it encapsulates a range of functions accessible to programmers.

Within the runtime OCX, these functions are categorized into sections, encompassing report management, preview handling, data-source manipulation, filtering, custom functions, column management, export functionalities, and progress tracking. The ensuing paragraphs furnish a succinct overview of each functional group.

Column Interface methods

API Arguments Returns Description
ColumnCount Returns Integer Returns the number of columns in a table
String sReportId
Integer iTable
ColumnIndex Returns Integer Returns the column main index
String sReportId
Integer iTable
Integer iColumn
ColumnLength Returns Integer Returns the column length
String sReportId
Integer iTable
Integer iColumn
ColumnName Returns String Returns the column name
String sReportId
Integer iTable
Integer iColumn
ColumnPrecision Returns Integer Returns the column precision
String sReportId
Integer iTable
Integer iColumn
ColumnType Returns Integer Returns the column type
String sReportId
Integer iTable
Integer iColumn

Data Source Interface

API Arguments Returns Description
DatabaseConnection - Gets/Sets the database connection string
String sReportId
String sConnection
DatabaseName - Gets/Sets the database name
String sReportId
String sDatabaseName
DatabaseType Returns Integer Returns the database type
String sReportId
IgnoreTrailingSpaces - Gets/Sets whether trailing spaces are allowed/ignored in RDS
Integer bIgnore
TableNameAlias Returns String Returns the alias name of a table
String sReportId
Integer iTable
TableCatalog Returns String Gets/Setsthe catalog name
String sReportId
Integer iTable
TableCount Returns Integer Returns the number of tables in the report
String sReportId
TableData - Sets the table data (RDS)
String sReportId
Integer iTable
Variant[] vData
TableName - Gets/Sets the name of a table
String sReportId
Integer iTable
String sName
TableSchema - Gets/Sets the schema name of a table
String sReportId
Integer iTable
String sSchema

Export Interface

API Arguments Returns Description
ReportExport - Export the report
String sReportId
Integer iType
String sFileName
ReportHTMLPreview Returns Variant Preview the report (HTML)
String sReportId
Integer iArgSize
CSVAllPages - CSV Export all pages
Boolean bAllPages
CSVExportGroupSections - CSV Export group sections (group headers and group footers)
Boolean bExportGroupSections
CSVExportPageSections - CSV Export page sections (page header and page footer)
Boolean bExportPageSections
CSVExportReportSections - CSV Export report sections (report header and report footer)
Boolean bExportReportSections
CSVFieldDelimiter - CSV Export Character delimiter
String sDelimiter
CSVFieldSeparator - CSV Export Value separator
String sSeparator
CSVPage - CSV Export Page number
Integer iPage
HTMLMultiPage - HTML Export Create Multi-Page export
Boolean bMultiPage
HTMLPage - Sets the page number for HTML export
Integer iPage
ImageExportType - Image Export Image type
Integer eType
ImageExportMultiPage - Image Export Create Multi-Page image
Boolean bMultiPage
ImageExportPage - Image Export Page number
Integer iPage
PDFPageMode - PDF Export Page display
Integer eMode
PDFType - PDF Export PDF Type
Integer eType
PDFOwnerPassword - PDF Export Owner Password
String sPassword
PDFUserPassword - PDF Export User Password
String sPassword
PDFImageQuality - PDF Export Image Quality
Integer eQuality
PDFAllPages - PDF Export all pages
Boolean bAllPages
PDFPage - PDF Export Page number
Integer iPage
PDFXMLFileName - PDF Export XML file
String sFileName
RTFAllPages - RTF Export All Pages
Boolean bAllPages
RTFPage - RTF Export Page number
Integer iPage
XLSVersion - XLS Export Excel version
Integer eXLSVersion
XLSNewSheet - XLS Export New Sheet
Integer eSheetOption
XLSColumnWidth - XLS Export Column width
Integer iWidth
XLSExportDataOnly - XLS Export Data only
Boolean bDataOnly
XLSExportPageSections - XLS Export page sections (page header and page footer)
Boolean bExportPageSections
XLSExportReportSections - XLS Export report sections (report header and report footer)
Boolean bExportReportSections
XLSExportGroupSections - XLS Export group sections (group headers and group footers)
Boolean bExportGroupSections
XLSExportNativeDatatype - XLS Export data using native Excel datatypes
Boolean bExportNativeDatatype
XLSAllPages - XLS Export All pages
Boolean bAllPages
XLSPage - XLS Export Page number
Integer iPage

Filter Interface

API Arguments Returns Description
FilterFunction - Gets/Sets the filter function
String sReportId
String sFilter
RecordFilterAdd - Adds a record filter
String sReportId
String sField
Integer eOperator
String sValue
RecordFilterCount Returns Integer Returns the number of record filters
String sReportId
RecordFilterDelete - Deletes a record filter
String sReportId
Integer iFilter
RecordFilterField - Gets/Sets the record filter field
String sReportId
Integer iFilter
String sField
RecordFilterOperator - Gets/Sets the record filter operator
String sReportId
Integer iFilter
Integer eOperator
RecordFilterValue - Gets/Sets the record filter value
String sReportId
Integer iFilter
String sValue

Function Interface

API Arguments Returns Description
Function Returns String Gets/Sets the function body
String sReportId
Integer iFunction
FunctionByName Returns Integer Finds a function by name
String sReportId
String sFunctionName
FunctionCheck Returns Integer Checks the function for errors
String sReportId
String sFunction
Integer iIndex
FunctionCount Returns Integer Returns the number of functions
String sReportId
FunctionError - Events that is being called when the function execution generates an error
String sError
Integer iLine
Integer iColumn
String sToken
FunctionIsEmpty Returns Integer Returns if a function is empty
String sReportId
String sFunction
FunctionIsSymbolUsed Returns Integer Returns if a symbol is used in any function
String sReportId
String sSymbol
FunctionLength Returns Integer Returns the length of a function
String sReportId
String sFunction
FunctionName Returns String Gets/Sets the function name
String sReportId
Integer iFunction
FunctionType Returns Integer Returns the data type of a function
String sReportId
String sFunction

Language Interface

API Arguments Returns Description
ReportLanguage Returns Integer Gets/Sets the language in use
String sReportId
ReportLanguageList Returns Variant Returns a list of supported languages
String sReportId

Parameter Interface

API Arguments Returns Description
ParameterByName Returns Integer Finds a parameter by name
String sReportId
String sParameterName
ParameterComment Returns String Returns the parameter comment
String sReportId
Integer iParameter
ParameterCount Returns Integer Returns the number of parameters
String sReportId
ParameterLength Returns Integer Returns the parameter length
String sReportId
Integer iParameter
ParameterName Returns String Returns the parameter name
String sReportId
ParameterPrecision Returns Integer Returns the parameter precision
String sReportId
Integer iParameter
ParameterType Returns Integer Returns the parameter type
String sReportId
ParameterValue Returns String Gets/Sets the parameter value
String sReportId
Integer iParameter

Preview Interface

API Arguments Returns Description
PreviewCanvasColor - Gets/Sets the Canvas color
Integer ePreviewCanvasColor
PreviewClick - Event that is being called when the user clicks in the preview
Integer iPos
Integer iSectionId
String
PreviewCurrentPage - Preview the specified page in the report
Integer iPage
PreviewFind - Find text in the preview window
String sString
Integer bDown
Integer bWholeWord
Integer bMatchCase
PreviewFindReset - Reset find in preview window
PreviewFirstPage - Preview the first page in the report
PreviewHScroll - Scroll the preview window horizontally
Integer iType
Integer iPos
PreviewHWND - Gets/Sets the preview window handle
Longptr hWnd
PreviewLastPage - Preview the last page in the report
PreviewNextPage - Preview the next page in the report
PreviewPaint - Paint the preview window
Integer bRedraw
PreviewPreviousPage - Preview the previous page in the report
PreviewShowPage - Event that is being called when the previewer shows a different page
Integer iPage
PreviewVScroll - Scroll the preview window vertically
Integer iType
Integer iPos
PreviewZoom - Gets/Sets the zoom factor
Integer iZoom
PreviewZoomChanged - Event that is being called when the zoom factor of the preview changed
Integer iZoom
PreviewWaitingGIF - Gets/Sets the name of the previewer waiting GIF
String sFileName
ReportHTMLPreview Returns String Preview the report (HTML)
String sReportId
Integer iBlockSize
Integer iPage
Boolean bEncode
ReportPreview - Preview the report
String sReportId
API Arguments Returns Description
PaperLength Returns Integer Returns the paper length
String sReportId
PaperMarginBottom - Gets/Sets the paper bottom margin
String sReportId
Integer iBottomMargin
PaperMarginLeft - Gets/Sets the paper left margin
String sReportId
Integer iLeftMargin
PaperMarginRight - Gets/Sets the paper right margin
String sReportId
Integer iRightMargin
PaperMarginTop - Gets/Sets the paper top margin
String sReportId
Integer iTopMargin
PaperOrientation Returns Integer Returns the paper orientation
String sReportId
PaperSize Returns Integer Returns the paper size
String sReportId
PaperWidth Returns Integer Returns the paper width
String sReportId
ReportPrint - Prints the report
String sReportId
Longptr hPrintDlg

Progress Interface

API Arguments Returns Description
ProgressCountPage - Event is being called when counting pages
Integer iPage
ProgressExportPage - Event is being called when exporting pages
Integer iPage
Integer iTotalPages
ProgressFormatPage - Event is being called when formatting pages
Integer iPage
Integer iTotalPages
ProgressRecordsRead - Event is being called when reading rows from a data-source
Integer iRecords

Report Interface

API Arguments Returns Description
ImportSubReport Returns Integer Re-import subreport
String sReportId
String sSubReportId
String sFileName
ImportPageLayer Returns Integer Re-import pagelayer
String sReportId
String sPagelayerId
String sFileName
PageLayerCount Returns Integer Returns the number of pagelayers
String sReportId
PageLayerId Returns String Returns the pagelayer id
String sReportId
Integer iPageLayer
PageLayerName Returns String Returns the pagelayer name
String sReportId
Integer iPageLayer
ReportCancel - Cancels the report output
String sReportId
ReportClose - Close the report
String sReportId
ReportError - Event is being called when the engine needs to report an error
Integer iError
String sError
ReportGroupInfo Returns Variant[N][6] Returns the group info
String sReportId
ReportInfo - Event is being called when the engine reports (additional) info
Integer iError
String sError
ReportIsBusy Returns Integer Get the report engine busy state
String sReportId
ReportName Returns String Returns the (sub)report name
String sReportId
ReportNoCancel Returns Integer Gets/Sets the status of No cancel
String sReportId
ReportOpenFromFile Returns String Open a report
String sReport
ReportPageCount Returns Integer Returns the page count
String sReportId
ReportQuery Returns String Returns the SQL query used in the report
String sReportId
ReportRefresh - Refresh the report
String sReportId
ReportStatistics - Event is being called with statistics information
Integer iType
Integer iValue
ReportSaveAsToFile - Save the report to a new file
String sReportId
String sFileName
SubReportCount Returns Integer Returns the number of subreports
String sReportId
SubReportId Returns String Returns the subreport id
String sReportId
Integer iIndex

Sort Interface

API Arguments Returns Description
RecordSortAdd - Adds a record sort
String sReportId
String sSortField
Integer eSortOrder
RecordSortCount Returns Integer Returns the number of record sorts
String sReportId
RecordSortDelete - Deletes a record sort
String sReportId
Integer iIndex
RecordSortField Returns String Gets/Sets the record sort field
String sReportId
Integer iIndex
RecordSortOrder Returns Integer Gets/Sets the record sort order
String sReportId
Integer iIndex