Report Execution

Scripts are always evaluated in the Report Generator phase, not in the Query Processor phase. When a report variable is used in more than one script, the order in which the scripts are executed is important.

There are up to three phases in the execution of a report. Within each phase, scripts are evaluated in ascending order of name unless there is a dependency between them that changes this.

The first process, the pre-process occurs when the Report Generator phase first starts, before any data from the Query Processor phase has been read. The pre-process covers scripts which do not access any data items. These scripts are evaluated once at the start.

The second process, called the reading phase occurs when the data for the report is read from the Query Processor phase. Scripts that are used selection, group, or sort criteria and those themselves summarized are evaluated at the reading phase.

The third process, the printing phase occurs when the data is printed. If both the reading phase and printing phase are present, the printing phase is a second reading of the data from the query engine, otherwise the reading phase and printing phase are combined. For example, with scripts A and B evaluated at pre-process time, C and D in the reading phase and E and F at print time, and three sets of data items (effectively three detail lines) present, data1 through data3, the overall order of script evaluation is:

  1. A

  2. B

  3. C (data1)

  4. D (data1)

  5. C (data2)

  6. D (data2)

  7. C (data3)

  8. D (data3)

  9. E (data1)

  10. F (data1)

  11. E (data2)

  12. F (data2)

  13. E (data3)

  14. F (data3)