![]() ![]() |
BIRT provides a powerful scripting capability with which a report developer can provide custom code to control various aspects of report generation.
There may be times when you want to determine the sequence of method execution. You can do this by writing code that generates a file containing a line for every method that you want to track.
To create an output file containing a sequence of method execution, include initialization code in the ReportDesign.initialize method and finalization code in the ReportDesign.afterFactory method. In each method that you want to track, add code to write a line of text to the output file. The following sections provide examples of the required code.
The following code in the ReportDesign.initialize method creates a file on your hard drive and adds one line to the file.
importPackage(Packages.java.io); fos = new java.io.FileOutputStream("c:\\logFile.txt"); printWriter = new java.io.PrintWriter(fos); printWriter.println("ReportDesign.initialize");
The preceding code does the following tasks:
You provide the preceding code for the ReportDesign.initialize method by performing the following steps:
The BIRT Report Designer appears as in the following illustration:
For every method that you want to track, provide a single statement similar to the following statement:
To provide code for a report item method you want to track, first select the appropriate object from the outline and select the appropriate method from the method selection list. Then use the same steps for entering code into a method as shown in the preceding procedure. To provide code for a data set or the data source method, select the appropriate data source or data set from Data Explorer before selecting the method you want to track.
The following statement in the ReportDesign.afterFactory method closes the file.
Using this method flushes all the buffers and ensures that all method output appears in the file.
To provide the ReportDesign.afterFactory code, select the top line of the outline and select the afterFactory method on the code page.
![]() ![]() |