Task 6:When you first create and preview a report, the report displays the data rows in the order in which the query returns them. The order can vary, depending on many factors, such as how data was supplied in the data source. In most cases, you will want to change the order in which data appears in the report.
2 Open Property Editor, if necessary. If you use the default report design perspective, Property Editor appears below the layout editor. If it is not open, choose Window->Show View->Property Editor.
3 In the layout editor, select the table by selecting the Table tab in the lower left corner. This tab appears when you hover the mouse pointer over this area. Property Editor displays the properties for the table, as shown in Figure 1‑19.
Figure 1-19 Figure 1‑20 shows the sort definition.
Figure 1-20
7 Preview the report. The sorted data appears in ascending order by customer name, as shown in Figure 1‑21.
Figure 1-21 Notice that names with uppercase letters appear at the top of the list. BIRT sorts string data by UCS2 code point values. In ASCII-based character sets, uppercase letters have lower code point values than lowercase letters. Therefore, uppercase letters appear before lowercase letters.
8 Sort the customer names case-insensitively so that ANG Resellers appears after American Souvenirs Inc., rather than before.
1 On the Sort page, shown in Figure 1‑22, select the sort key, then choose Edit.
Figure 1-22
2 On Edit Sort Key, change the Sort Key expression to the following expression, then choose OK:This expression uses the JavaScript toUpperCase( ) function to convert all the customer name values to uppercase before sorting. JavaScript function names are case-sensitive, so you must type toUpperCase( ) exactly as shown. References to column names are also case-sensitive. In this expression, row["CUSTOMERNAME"] is the correct name to use. If you type row["customername"], for example, BIRT Report Designer displays an error when you run the report. You can verify the capitalization of a column name by looking at the name that is displayed in Data Explorer.
9 Preview the report. The customer names appear in a different order. Names with uppercase letters do not appear at the top of the list.
(c) Copyright Actuate Corporation 2008 |