Prev | Current Page 179 | Next

John Ward

"Practical Data Analysis and Reporting with BIRT"

The above Expression
illustrates that a single value is returned with a very simple line of code.
In the following example, we are going to add a line number to the order
detail Table.
1. Open the Customer Orders report from Chapter 8.
2. Insert a column to the left of the CustomerNumber column.
3. Insert a Data element in the cell for the detail band.
4. For the Expression, enter the following:
row.__rownum + 1
5. Hit OK and Preview the report.
There is now a column with the current line number for the report. While not
exactly the most attractive addition, the Expression works. We have seen Expressions
such as these throughout the book. In the Customer Orders report, the Report
Title is pulled from the rprmReportTitle parameter using the expression
params["rprmReportTitle"].
Scripting and Event Handling
[ 240 ]
As we saw with the Bar Chart example, Expressions are simply JavaScript.
Expressions also have access to JavaScript methods, operators, and objects. In the
line number example just explained, we used the addition operator, and in the Bar
Chart example, we used the toString(), getMonth(), and getYear() methods. All
assignment operators??”math, comparison, and logical??”available in JavaScript are
included. Let's look at the following example, which shows the JavaScript String
methods being used to return the length of a String.


Pages:
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
życzenia katalog stron katalog stron pozycjonowanie Connie Talbot