How a Report is rendered
The Report object determines where the report is being sent, what pages to print, whether the report is portrait or landscape, etc.
When a report is rendered (generated):
The report’s firstPageTemplate property determines which pageTemplate is rendered first (assuming there are more than one).
All objects defined for that pageTemplate are rendered in the order in which they are listed in the source code (the z-order), not the order in which they appear on the design surface.
The streamSource is controlled by the data, or more specifically, by the rowset generated by a query. Most Reports have only one streamSource, and the rowset for that streamSource controls the report.
The streamSource controls how a streamFrame is rendered. A detailBand is rendered inside the streamFrame for every row in the rowset referred to by the streamSource. Each page can have multiple streamFrames.
There can be multiple streamFrames on a page. After one streamFrame is filled up, any remaining rows are rendered in other streamFrames on the same pageTemplate. This is how labels and columnar reports are generated.
When the current streamFrame is the last one on the pageTemplate, and the rowset contains rows remaining to be rendered, the pageTemplate’s nextPageTemplate property identifies the page to be rendered next. For a report that uses the same page over and over, the same pageTemplate object is used for both the report’s firstPageTemplate property and the pageTemplate’s own nextPageTemplate property. You can create a different introduction or cover page for a report by specifying the cover page as the report’s firstPageTemplate property, and then setting the cover page’s nextPageTemplate property to the PageTemplate for the body pages. To alternate left and right pages, set the nextPageTemplate of the left page to the right page, and vice versa. Then specify the right-hand page as the report’s firstPageTemplate property.
Once a new pageTemplate has been scheduled to be rendered, the report's onPage event handler fires, and the process continues until all rows in the rowset have been rendered.
The sequence of events and methods
The Report object's render( ) method is called.
Before each component in the band is rendered, its canRender event fires. The canRender event can be used to supplement the suppressIfBlank and suppressIfDuplicate properties of the Text component by returning false, but it is more often used to alter the properties of a component just before it is rendered. For example, you can set a component’s colorNormal to red if it’s going to display a negative number. When used this way, the canRender event handler does what it wants and returns true, and the component is rendered.
After the component is rendered, its onRender event fires. You can use the onRender event to reset a component to its original state.
Once the current page has finished rendering, the Report object’s onPage event fires. If there is another page scheduled, it is rendered. Its StreamFrame objects are filled with data and the process repeats itself until all the StreamSource objects are exhausted.
The onPage event fires one last time and the report is done.