Previous Next

Using JavaScript to Write an Event Handler : Tutorial 7: Writing an event handler in JavaScript : Task 4: Display the result using the ReportDesign.afterFactory( ) method

Task 4:
Display the result using the ReportDesign.afterFactory( ) method

To display the count of customers with the string Mini in their names, you insert code in a method that runs after the processing of all the rows in the table. One logical place for this code is in the ReportDesign.afterFactory( ) method.

1

Figure 23-9 Selecting the report design in Outline

Figure 23-9
2
Select the afterFactory( ) method from the script window drop-down list.
3
importPackage( Packages.javax.swing );
countOfMinis = reportContext.getPersistentGlobalVariable("cmKey").intValue();
frame = new JFrame( "Count of Minis = " + countOfMinis );
frame.setBounds( 310, 220, 300, 20 );
frame.show( );
4

Figure 23-10 Result of changing the afterFactory( ) method

Figure 23-10

If you do not see the Count of Minis window, look for it behind the Eclipse window. If the Count of Minis window does not appear, the most likely reason is a scripting error caused by an error in one of your code entries.

If you suspect that a scripting error occurred, scroll to the bottom of the report where all scripting error messages appear. In most situations, there is a brief error message next to a plus sign ( + ). The plus sign indicates that there is a more detailed error message that is only visible after you expand the brief error message. To expand the brief error message, choose the plus sign. Scroll down to see the more detailed error message.


(c) Copyright Actuate Corporation 2008