Send report data to a browser

You can view a report in a browser with Genero Report Viewer for HTML5. Specific reporting API functions must be included in your program to display to this client.

When you start the demo program OrderReport.4gl, the application gives the user the option to output the report data to the Genero Report Viewer. If the Genero Studio configuration is set to use the Web configuration, this option displays the report to a browser, using Genero Report Viewer for HTML5.

To do this, the device must be set to "Browser".
CALL fgl_report_selectDevice("Browser");
When the device is set to Browser, some additional APIs must be called. You must set the browser directory and URL, and you must set the font directory and URL. For example:
IF outputformat=="Browser" THEN
  LET uuid=security.RandomGenerator.CreateUUIDString()
  CALL fgl_report_setBrowserDocumentDirectory(fgl_getenv("GRE_PRIVATE_DIR")||"/"||uuid)
  CALL fgl_report_setBrowserFontDirectory(fgl_getenv("GRE_PRIVATE_DIR"))
  CALL fgl_report_setBrowserDocumentDirectoryURL(fgl_getenv("GRE_PRIVATE_URL_PREFIX")||"/"||uuid)
  CALL fgl_report_setBrowserFontDirectoryURL(fgl_getenv("GRE_PRIVATE_URL_PREFIX"))
END IF

The report files

When you select Browser as the output for your report, the report files are written to the document directory.

If you are using a private directory (GRE_PRIVATE_DIR and GRE_PRIVATE_URL_PREFIX), only the current session will be able to view the report, and the report will be deleted when the session ends.

If you are using a public directory (GRE_PUBLIC_DIR and GRE_PUBLIC_URL_PREFIX), the report can be shared and bookmarked.

Warning: The environment variables GRE_PRIVATE_DIR, GRE_PRIVATE_URL_PREFIX, GRE_PUBLIC_DIR, and GRE_PRIVATE_URL_PREFIX are not documented. You should never explicitly set these variables.