PANTHEON™ Help

 Toc
 PANTHEON Help - Welcome
[Collapse]PANTHEON
 [Collapse]Guides for PANTHEON
  [Collapse]Guide for PANTHEON
   [Collapse]Settings
    [Expand]Subjects
    [Expand]Items
    [Expand]POS
    [Expand]Manufacturing
    [Expand]Personnel
     Calendar
    [Expand]Financials
    [Expand]Customs
    [Collapse]Program
     [Expand]Document Types
     [Collapse]Reports in PANTHEON
       Settings in Administration Panel
      [Expand]Reports Register
       Print Preview
      [Expand]Report Designer
      [Expand]Creating Reports
      [Expand]Groups and Aggregates
      [Expand]Formatting and Highlighting
       Nested Reports (Subreports)
      [Expand]Specifics of Printouts in PANTHEON
      [Collapse]Script
        "Hello, World!" Script
        Using Variables, Database Fields, and Aggregate Functions
        Using Report Objects in the Script
        Events
        Example of Using the "OnBeforePrint" Event
        Printing a Group Sum in the Group Header
        Running Total
        "OnAfterData" Event
        Service Objects
        Using the "Engine" Object
       [Expand]PANTHEON Functions for FastReport
       [Expand]Examples with Tables and Queries
       Report Design Considerations
      Document Texts
      Delivery Methods
     [Expand]Loyalty Cards
     [Expand]Administration Panel
     [Expand]Dashboard Components
      Dashboard Reports
      Ad-hoc analysis
     [Expand]ARES
      SQL urejevalnik
    [Expand]Documentation
    [Expand]Change User
   [Expand]Orders
   [Expand]Goods
   [Expand]Manufacturing
   [Expand]POS
   [Expand]Service
   [Expand]Financials
   [Expand]Personnel
   [Expand]Analytics
   [Expand]Desktop
   [Expand]Help
   [Expand]Messages and Warnings
   [Expand]Additional programs
   [Expand]Old products
  [Expand]Guide for PANTHEON Retail
  [Expand]Guide for PANTHEON Vet
  [Expand]Guide for PANTHEON Farming
 [Collapse]User Manuals for PANTHEON
  [Expand]User Manual for PANTHEON
  [Expand]User Manual for PANTHEON Retail
  [Expand]User manual for PANTHEON Vet
  [Expand]User Manual for PANTHEON Farming
[Collapse]PANTHEON Web
 [Collapse]Guides for PANTHEON Web
  [Expand]Guide for PANTHEON Web Light
  [Expand]Guide for PANTHEON Web Terminal
  [Expand]Guide for PANTHEON Web Legal
  [Expand]Old products Archive
 [Collapse]User Manuals for PANTHEON Web
  [Expand]Getting started PANTHEON Web
  [Expand]User Manual for PANTHEON Web Light
  [Expand]User Manual for PANTHEON Web Terminal
  [Expand]User Manual for PANTHEON Web Legal
  [Expand]Old products Archive
[Collapse]PANTHEON Granules
 [Collapse]Guides for PANTHEON Granules
  [Expand]Personnel Granule
  [Expand]Travel Orders Granule
  [Expand]Documents and Tasks Granule
  [Expand]Dashboard Granule
  [Expand]B2B Orders Granule
  [Expand]Field Service Granule
  [Expand]Fixed Assets Inventory Granule
  [Expand]Warehouse Inventory Granule
 [Collapse]User Manuals for PANTHEON Granules
  [Expand]Getting started
  [Expand]Personnel Granule
  [Expand]Travel Orders Granule
  [Expand]Documents and Tasks Granule
  [Expand]B2B Orders Granule
  [Expand]Dashboard Granule
  [Expand]Field Service Granule
  [Expand]Fixed Assets Inventory Granule
  [Expand]Warehouse Inventory Granule
  [Expand]Archive
[Expand]User Site

Load Time: 421.8858 ms
"
  1006305 | 218664 | 354834 | Published
Label

Referencing the Database Fields

Events

So far we have looked at scripts with only a main procedure, which is executed when a report starts running. In the main procedure initial settings can be made and variables initialized. However this is not enough for total control over the process of report generation. To enable as much control as possible over report generation every object has several events to which handlers (i.e. procedures in the script) can be assigned. For example, connecting a handler to the data band enables records to be filtered, such that the band can be hidden or revealed according to specific conditions being met.

Let's demonstrate the process of report creation and the events triggered by means of a simple report containing one page and having one “MasterData” band, with two “Text” objects on the band:

clip0191

As described above, the script's main procedure is called at the very start of running the report. After that the essentials of report construction begin. Firstly the “OnStartReport” event of the "Report" object is called. Then, before an output page is created, the “OnBeforePrint” page event is called. This event is called once for each design page in the report template (design pages should not be confused with the output pages of a report!). In our example the event is called once, as the report design consists of only one design page.

Then the events of the data bands are called in the following order:

1. the band's “OnBeforePrint” event is called

2. the “OnBeforePrint” event of each object contained in the band is called

3. each object is filled with data (in our example with values of the “Company” and “Addr1" DB fields)

4. the “OnAfterData” event of each object is called

5. actions such as positioning objects on the band (if there are stretchable objects among them), calculating band height and stretching it (if it is stretchable) are performed

6. the band's “OnAfterCalcHeight” event is called

7. a new output page is created if the band hasn't enough room in the page's white space

8. the band and all of its objects are displayed on the output  page

9. the “OnAfterPrint” event of each band object is called

10. the “OnAfterPrint” event of the band itself is called

Bands continue to be printed as long as the source connected to the band has data. After that report printing stops, the report page's “OnAfterPrint” event is called and finally the “Report” object's “OnStopReport” event.

So by using the events of different objects practically every step of the report creation process can be managed. The key to using events is a thorough understanding of the band output process, which is discussed in the next sections. Most of the actions can be performed using the band's “OnBeforePrint” event only; any modifications made to an object are displayed immediately. However, if the band is stretchable, it is impossible to say in this event on which page the band will be printed, since calculation of the band's height is performed in step 5. It can be done, however, either in the “OnAfterCalcHeight” event in step 6 or in the “OnAfterPrint” event in step 9. Note that in the last event the band will already have been output so modification to objects will not have any visible effect.

It is essential to clearly understand “where and when” the bands are output and to understand the timing (calling order) of each of their events. Likewise for each of the objects contained in the bands.


 

Rate this topic
Was this topic usefull?
Comments
Comment will also bo visible in forum!