From an XML file

You can get the report data from an XML file instead of getting it directly from a database.

The XML file can be a ProcessLevelData file created by a Genero report ( Output to an XML File) which has a special format, or it may be an arbitrary XML file.

From A ProcessLevelData file

This XML file has a special format, and is created using the Report Writer API function fgl_report_createProcessLevelData File().

The MAIN block of SimpleReport.4gl would change as follows:

MAIN

   DEFINE handler om.SaxDocumentHandler, -- report handler 
          data_file String,              -- XML file containing data 
          report_ok boolean              -- return value from function 

    --call the mandatory functions that configure the report  
  IF fgl_report_loadCurrentSettings("myreport.4rp") THEN -- if  the file
                                                         --  loaded OK
    LET handler = fgl_report_commitCurrentSettings()     -- commit the file 
                                                         -- settings
  END IF

  --call the report driver to run the report
  IF handler IS NOT NULL THEN  
    LET data_file = "./OrderReportData.xml"
    LET report_ok = 
           fgl_report_RunReportFromProcessLevelDataFile(handler, data_file) 
  ELSE
    EXIT PROGRAM
  END IF

END MAIN

From Other XML files

XML files that were not created by the Reporting API function fgl_report_createProcessLevelData File() can be used as the data source for a Genero report. The file OrderData.xml in the demo sample files of the Reports project is an example of this type of file.

The function fgl_report_runFromXML is used to specify the data source:

This example is from the OrderReportXML.4gl demo program in the Reports project:
MAIN

  IF NOT fgl_report_loadCurrentSettings("Table.4rp") THEN
    EXIT PROGRAM
  END IF

  IF NOT fgl_report_runFromXML("OrderData.xml") THEN
    DISPLAY "RUN FAILED"
    EXIT PROGRAM
  END IF

END MAIN