View report in a browser
Display a report in a browser using Genero Report Viewer for HTML5.
Browser
":CALL fgl_report_selectDevice("Browser");
Launch the browser using the fgl_report_getBrowserURL()
function. For example:
IF outputformat=="Browser" AND preview
THEN
CALL ui.Interface.frontCall( "standard", "launchurl", [fgl_report_getBrowserURL()], [] )
END IF
When you select Browser as the output for your report, the report files are written to the document directory.
Setting the browser directories
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"))
IF preview THEN
CALL ui.Interface.frontCall( "standard", "launchurl", [fgl_getenv("GRE_REPORT_VIEWER_URL_PREFIX")
||"/viewer.html?reportId="||uuid||"&privateUrlPrefix="||fgl_getenv("GRE_PRIVATE_URL_PREFIX")], [] )
END IF
To use the viewer.html file residing on the FGL/GAS Server, use the GRE_REPORT_VIEWER_URL_PREFIX variable. To use the viewer.html file residing on the GRE Server side, use the GRE_REPORT_VIEWER_R_URL_PREFIX variable and copy the GRE/viewer directory into the GRE document root directory.
If you are using a private directory (GRE_PRIVATE_DIR and GRE_PRIVATE_URL_PREFIX), only the current session can 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.
The environment variables GRE_PRIVATE_DIR, GRE_PRIVATE_URL_PREFIX, GRE_PUBLIC_DIR, and GRE_PRIVATE_URL_PREFIX are automatically set in the GAS. You should never explicitly set these variables in Genero Report Writer (GRW).