value != null )
{
//Bring in the BIRT Report Model API and for CONSTANTS
importPackage( Packages.org.eclipse.birt
.report.engine.api.script.element );
//Create a dynamic sort condition
var sortCondition = StructureScriptAPIFactory.
createSortCondition();
//Based on the value of the sort parameter, set the appropriate key
value for sorting
switch (params["paramSortOrder"].value)
{
?°
?° ?° ?°
Chapter 10
[ 249 ]
//Remember that for the key, we need to use the fully qualified
row and field name as a string, not as a value
case "date" :
sortCondition.setKey("row[\"PAYMENTDATE\"]");
break;
case "price" :
sortCondition.setKey("row[\"AMOUNT\"]");
break;
}
//set condition to ascending order
sortCondition.setDirection("asc");
//Add to the table
this.addSortCondition(sortCondition);
}
6. In the Header Row, we need to create Hyperlinks that will call this report, and
pass in parameters to tell which column to sort by. So, save the report as it is;
otherwise, the parameters will not show up in the Drill-Down Dialog. Select
the PaymentDate column header, and create a Hyperlink like the following:
Select Drill-Down.
Link to the customerPayment.rptdesign file.
Select the rptprmCustomerID field, and set the value to para
ms["rptprmCustomerID"].
Select the rptprmSortOrder parameter, and set the value to
"date" with the quotation marks.
Pages:
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202