Prev | Current Page 189 | Next

John Ward

"Practical Data Analysis and Reporting with BIRT"

It is run from the
report's initialize method.
reportContext.getReportRunnable().designHandle.getDesignHandle().findE
lement("dataElementToRemove").drop();
Adding Sorting Conditions
In addition to adding report elements, it is also possible to add conditions, such as
Highlights, Maps, and Sorting conditions. The following example will show how
to dynamically add Sorting conditions to a report based on the value of a Report
Parameter checkbox.
1. Create a new report in a BIRT Reporting Project. Call this new report
customerPaymentDynamicSort.rptdesign. Bring in the dsClassicCars Data
Source from the Library. Create a new Data Set using the following query:
select
*
from
CUSTOMERS,
Scripting and Event Handling
[ 248 ]
PAYMENTS
where
CUSTOMERS.CUSTOMERNUMBER = PAYMENTS.CUSTOMERNUMBER
and customers.customernumber = ?
Name the parameter as dsprmCustomerID.
2. Under the Dialog for the Data Set Parameter, create and link to a report
parameter called rptprmCustomerID. Set it as a Text Box entry.
3. "Drag and drop" the newly created Data Set over to the Report Design pane.
Delete all columns except for the following:
CustomerNumber
CustomerName
PaymentDate
Amount
4. Create a new Report Parameter called rptprmSortOrder. Set it to allow null
values and hidden.
5. Add the following Script to the OnPrepare Event of the Table:
//We only want to add this into our code when the value is not null
for the parameter sort
if ( params["paramSortOrder"].


Pages:
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
Apartamenty Świnoujście noclegi hel Lokaty jednodniowe projekty domków letniskowych męskie skarpetki rowerowe