eclipse.birt.report.engine.api.script package. This object
allows Script developers access to the design object, report parameters, and various
other aspects of the report, although many of these objects are shorthanded by other,
easier-to-use references, such as using the params array to access Report Parameters.
Let's take a look at how to access parameters:
1. Open the String Length.rptdesign file.
2. Create a new Report Parameter called accessMe as a String, and assign it the
Default value of "Test Parameter".
3. Drag a Data component over to the Report Designer, and for the Expression,
enter valueFromScript.
4. In the report designer, open the Script tab.
5. Open the Outline pane.
6. In the Outline, select the Root element String Length.rptdesign.
7. Open the Palette view.
Chapter 10
[ 245 ]
8. When the Script tab is open, the Palette view changes to allow quick access
to different objects and methods in the same way the Expression Editor does.
9. In the Script Editor, under the initialize Event, put in the following code:
valueFromScript = params["accessMe"];
10. Take a moment to play around with the Palette. You can see that if
you double-click on the reportContext under the Context folder, it will
automatically put that into the Script Editor. Also, when you are typing, you
may notice that a drop-down box appears that allows you to see all of the
objects and properties associated with the reportContext object.
Pages:
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197