pODBCReportIF
pODBCReportIF
Interface to third party tools that can read text files by means of ODBC.
Syntax
pODBCReportIF ( in vlReportName,
in vlFormat,
in vlGenSchema,
in vlGenData,
in vlRepCmd )
Parameters
vlReportName | The name of a report application component generated using DC. |
vlFormat | The output format for the report data and the schema file. |
vlGenSchema | A flag indicating if the schema file should be generated. |
vlGenData | A flag indicating if data should be exported from Zim for use by the report package. |
vlRepCmd | The command to use to launch the report package. |
Comments
ODBC (Open Data Base Connectivity) is a Microsoft-defined interface for sources of data. Tools that are able to read by means of an ODBC interface (ODBC clients) can access data from any source that presents an ODBC interface (ODBC servers). Report writers (products such as Crystal Reports, ReportSmiths, and Impromptu) are the most common type of ODBC client. For more information about ODBC drivers in Zim, see About the ODBC Drivers.
Most ODBC clients can read fixed format or comma-delimited text files through their ODBC interface. In order to read a text file by means of ODBC, the file must be described (i.e. the field names, data types, and so on). There are several ODBC text drivers used by different products. Most ODBC text drivers determine the format of text files by reading a “schema” file (common names are SCHEMA.INI or QETXT.INI) which must be in the same directory as the text file. These files are usually created using a Microsoft utility called ODBCADM.EXE which is supplied with ODBC clients.
The pODBCReportIF program generates a text file (called DATAFILE.TXT) along with a corresponding schema file that is suitable for use with a number of ODBC clients. Both files are created in the working directory. vlReportName is the name of a report application component you have created using the Development Center. If vlGenData is $True, then pODBCReportIF analyses the definition of vlReportName and dynamically generates the text data file based on the definition of report components, report columns, report selection, and report sorting. If vlGenData is not $True, no data file is created. If vlGenSchema is $True, then the corresponding schema file is created. If vlGenSchema is not $True, the schema file is not generated. If vlRepCmd is not blank, it is assumed to be a command to launch the ODBC client program. That command is executed in the background using the SYSTEM command.
pODBCReportIF supports two output formats. In both cases, the format of the data file is consistent with the definition in the schema file.
- If vlFormat is ‘Q’, then the schema file is placed in a file called QETXT.INI and the data file is created in comma delimited format with the field names appearing as the first line in the file. This format is compatible with the Q&E ODBC text driver used by products such as Crystal Reports.
- If vlFormat is ‘S’, the schema file is placed in a file called SCHEMA.INI and the data is created in fixed format without field names. This format is compatible with the ODBC text driver used by products such as ReportSmiths.
If your ODBC client uses a text driver that is not compatible with either of the above, you should generate a sample data file and use the standard ODBC administrator tool (provided with the ODBC client) to create a suitable schema file.
To interface to a third party reporting tool, first create a number of report definitions that produce the input data required by the report. Then, insert into the application a call to pODBCReportIF that generates the data and the schema file and launch the report tool. You can also create standard report definitions using the reporting tool.
If you plan to distribute your application with a Query Runtime system, you need to distribute
- the report definition files stored in the ZimREP DOS directory which is located in your database directory.
- the files Zim0068, Zim0069, Zim0071, Zim0072, Zim0076 located in the DCRT directory within your database directory.
Example
If a report application component called OrderRep has been created using DC, then the following call creates the data file and the schema file and then launches Crystal Reports (which must be already installed on your system).
pODBCReportIF (“OrderRep”, “Q”, $True, $True, “C:\CRW\CRW.EXE”)
This code first produces a QETXT.INI schema file and a data file in comma delimited format. Then, it launches Crystal Reports.