So, we would be in the Startup phase
first; then we would retrieve and transform the data. Then, we would generate
the report with the values of our data. Then, we would render the report in the
presentation phase. And finally, we would shut down the Engine. The Events that
are called (and in what order) for the Generation Phase and Presentation Phase are
illustrated in the previous figure.
Let's say for example, we have two things that we need to do with the Data Set. First,
we need to initialize a counter variable to 0 for the number of rows that are going to
be processed. Next, we need to add to the counter each time a row is retrieved. So,
where we do these things is important. The order in which these Events take place
is beforeOpen, afterOpen, onFetch, beforeClose, and afterClose. So, in either the
beforeOpen or afterOpen, we need to set our variable to 0. Then, in the onFetch
event, we need to add 1 to our counter. Let's look at an example for how to do this:
1. Open Customer Orders.rptdesign.
2. First, we need to define the global variable that we will use for our count. In
the Report Designer, open the Script tab.
3. Using the Outline, select the Root element Customer Orders.rptdesign.
4. In the Event drop-down, select initialize.
5. Use the following code to define our global variable:
var globalCount;
6.
Pages:
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195