Overloadable functions

You can redefine certain functions by overloading them.

Genero Report Writer includes the following overloadable modules:

  • CaptionCustom -- contains the report_getFieldCaption() function, which provides a caption string for a specified field.
  • CompatCustom -- contains the following functions:
    • compat_placePageBackground() provides PXML markup for the page background.
    • compat_outputCompleteLine() generates markup for the text of a complete line.
    • compat_outputLinePart() generates markup for the text of a line item.
  • EncodingCustom -- contains the getXMLEncodingString() function, which provides an encoding string for the application and its data.

The compiled versions (.42m) are provided in $GREDIR\lib. The source files (.4gl) are in $GREDIR\src\overloadables; further information about the individual functions can be found in these source files.

To overload the functions:

  1. Create a copy of the .4gl file.
  2. Make changes in the copied file.
  3. Build the module using the copy. Store the complied .42m module in a different directory using the same name as the original (for example, CaptionCustom.42m).
  4. Place the directory containing the .42m in FGLLDPATH before the directory containing the default implementation. For further information, see FGLLDPATH in the Genero Business Development Language User Guide.

Example

CompatCustom.4gl includes the function compat_placePageBackground(). When creating a compatibility report, the Genero Report Engine calls compat_placePageBackground(out,reportName,reportCategory,pageNumber), which performs specific actions when the report category is either "demo" or "form".

You introduce another report category, "correspondence". For all reports in this category, you want to place a company logo. You create a copy of CompatCustom.4gl, modify the code to add the company logo, compile your modified module, and update FGLLDPATH to load the new version.

For further details about configuring compatibility reports, see Compatibility reports.

.