Create a process-level XML data file
Set up and configure output to XML from your reporting application. A process-level XML data file is the XML as provided by the .4gl application.
You can produce this file:
Instead of another report
The function fgl_report_createProcessLevelDataFile()
instructs
the Genero Report Engine to execute the report, outputting the data specified in the
PRINT function of the REPORT program block to an XML file rather than to a report
design document. The name of the data file is passed to the function as a
String.
fgl_report_createProcessLevelDataFile()
, the MAIN program block
becomes:MAIN
DEFINE handler om.SaxDocumentHandler, -- return value
dataFile STRING -- name of XML file to be created
--configure the report engine to output the XML file
LET dataFile = "./OrderReportData.xml"
LET handler = fgl_report_createProcessLevelDataFile(dataFile)
-- run the report, creating the XML file
CALL runReportFromDatabase(handler)
END MAIN
At the same time as another report
The function fgl_report_setProcessLevelDataFile()
instructs the
Genero Report Engine to create an XML file as well as a report. This can be a useful
option if you have long reports.
Changing the SimpleReport.4gl example program to use
fgl_report_setProcessLevelDataFile()
, the MAIN program block
becomes:
MAIN
DEFINE handler om.SaxDocumentHandler, -- return value
DEFINE dataFile STRING -- name of XML file to be created
DATABASE "officestore"
--configure the report engine to output the XML file
IF fgl_report_loadCurrentSettings("accountlist1.4rp") THEN
LET datafile = "./officestoredata.xml"
CALL fgl_report_setProcessLevelDataFile(datafile)
LET handler = fgl_report_commitCurrentSettings()
ELSE
EXIT PROGRAM
END IF
-- run the report, creating the XML file
IF handler IS NOT NULL THEN
CALL run_report1_to_handler(handler)
END IF
END MAIN