Generate Spreadsheet Data |
The *TOOLS/QRYEXPORT utility can be used to export data to a spreadsheet-supported file based on a query definition. It can be invoked in your program using the CALL directive:
CALL "*tools/qryexport", queryName$, queryLib$, exportfile$ [, queryopts$, show_flg$]
The file has a header record consisting of the column headings defined in the query, followed by data records of the resulting query data set. The file types that are supported are comma separated (.csv), tab delimited (.txt), symbolic link (.slk) and Microsoft XML (.xml), dependent upon the extension on the export file name.
There are also options to include hidden query columns and determine interactive run-time behavior.
Example:
CALL "*tools/qryexport","qClient","panels.en","customer.xml","","PD"
This code generates an XML file based on the qClient query definition, excludes any hidden columns, displays a progress bar while it is generating the file, and displays the result using the default app (e.g. Excel).