Use this script if you want to define additional file types for output in Stonefield Query. For example, if you want to output to Microsoft Excel files but perform special processing, you can use this script to define a new file type and a user-defined script to perform the actual output.
Parameters
A reference to the Stonefield Query Application object.
Return Value
An XML string defining the file output settings. The format for the XML is as follows:
<settings>
<setting>
<description>Setting description</description>
<filetype>File extension</filetype>
<script>Script name</script>
</setting>
</settings>
The following elements are available:
description: the description for the file type. This description appears in the Save as type drop-down list in the Output to File dialog when the user clicks the File button in the Output page of the Reports Explorer. This element is required.
filetype: the extension of the file to use, such as "txt." This element is required.
script: the name of a script that performs the output. This script is called when the user clicks the Process button to perform the output. The script code must accept four parameters: a reference to the Stonefield Query Application object, the name and path of the file the user chose, the name of the result set cursor containing the data, and the name of the report. The script code can do anything you wish; for example to generate a file for the report, call ReportEngine.RunReportToFile. This element is required.
Example
Here's an example that defines a new file type, Data Export File, with an XPT extension.
Visual FoxPro
lparameters toApplication as SQApplication
local lcXML
lcXML = '<settings>' + ;
'<setting>' + ;
'<description>Data Export File (*.xpt)</description>' + ;
'<filetype>xpt</filetype>' + ;
'<script>DataExportOutput</script>' + ;
'</setting>' + ;
'</settings>'
return lcXML
The DataExportOutput script generates a simple XML file with "DataSet" as the element name for each record:
lparameters toApplication as SQApplication, tcFileName, tcCursor, tcReportName
cursortoxml(tcCursor, 'lcXML')
lcXML = strtran(lcXML, tcCursor, 'DataSet')
strtofile(lcXML, tcFileName)
See also
Scripts© Stonefield Software Inc., 2023 • Updated: 06/06/16
Comment or report problem with topic