Implementation Guide for Oracle Self-Service E-Billing > Using the Reporting Engine > Core Reporting Features >

Sorting Feature of the Reporting Engine


Sorting is a built-in feature of the report engine. It is available when you use the ReportActionHelper class from your action class. With the reporting XML and template, enabling sorting is like configuring a transformer's column. For example:

<column sortable="true" .../>

Only single column sorts are supported. The sorting is done in-memory, to eliminate accesses to the data source.

Set the column attribute sortable to true. The Reporting Engine reads the configuration, instructs the template to generate a sort-able link for the corresponding table column name, and the ReportActionHelper class calls the ITransformer.sort() API.

When a column is defined as sort-able, the report_body.vm template renders the column of the HTML table with a URL link. For example:

<a href="$link?sortColumn=$x&reportId=$reportId&transformerId=$transformerConfig.id&currentSortColumn=$currentSortColumn&ascending=$ascending&currentGroup=$groupIndex">

Table 41 describes the parameters in the URL.

Table 41. Sorting Parameters in the URL
Parameter
Description

$link

The URL context base, which is set to

http://host:port/<web-context>/report.do in ReportActionHelper class, where <web-context> is the Web context you defined in your EAR file.

SortColumn=$x

This is the column index of the column being sorted in the transformer configuration.

Reported=$reported

The report ID of the report.

TransformerId=$tranformerConfig.id

The ID of the transformer currently being sorted

CurrentSortColumn=$currentSortColumn

This is the current column being sorted in this transformer.

Ascending=$ascending

Defines the sort order, true or false.

CurrentGroup=$groupIndex

Not used but can be used for grouping.

The Web component must process the URL request, and calls the ITransfomer.sort() method to sort the column. The Helper class, ReportActionHelper does this work for you.

Just call the ReportActionHelper in your struts action. It processes this request and calls Itransfomer.sort() to sort the column, then reorders the newly sorted report for you.

Implementation Guide for Oracle Self-Service E-Billing Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Legal Notices.