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.

For example, you might want to create a report using different formats but the same data. If you simply run the report twice, it may be produced with different data. Process-level XML data provides a "snapshot" of the report data at a particular point in time, which you can reuse to create more than one report. See Fetching report data from an XML file.

You can produce this file:

Instead of another report

The function fgl_report_create ProcessLevelData File() 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.

Changing the SimpleReport.4gl example program to use fgl_report_create ProcessLevelData File(), 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_set ProcessLevelData File() instructs the Genero Report Engine to output an XML file as well as another document, such as a PDF. 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