Tips

Tips for writing a BDL report program.

  1. The Reporting API functions fgl_report_loadCurrentSettings and fgl_report_CommitCurrentSettings are required and must be called in sequence. (Calls to these functions bracket any calls to other functions that change the default output options.) These functions must be called in the program prior to executing the START REPORT command in the Report Driver. If your program does not change the default output options, you can simply call the single function fgl_report_loadAndCommit instead.
  2. Always use ORDER EXTERNAL in the REPORT program block to tell the report that the input records have already been sorted by the SELECT statement, and there is no need for the program to resort the fields. This will improve performance.
  3. Restrict your use of control blocks in the REPORT program block to FIRST PAGE HEADER, BEFORE GROUP OF, AFTER GROUP OF, ON EVERY ROW, or ON LAST ROW. See The Report Program Block.
  4. Prefer the use of fields over expressions to hold report values. Since expressions don't have names, it will be difficult to reference them in the Report Design Document (they could only be referenced by index).
  5. Prefer calculating values in the REPORT program block over calculating in the Report Design Document, to use the power of the DVM.
  6. Don't be stingy when outputting fields; this will enhance the ability to use the BDL source for multiple report formats. Define a record, orderline for example, that contains all the data fields retrieved from the database by the database cursor; use that record definition in the OUTPUT to REPORT statement:
      OUTPUT TO REPORT <reportname> (orderline.*)
  7. Check if the user has aborted the report, as well as if any errors have occured, by calling fgl_report_getErrorStatus() after OUTPUT TO REPORT or FINISH REPORT.