Sorting report data

You can sort the records in a banded object or table, and the groups in a certain group level of the banded object or table if you have defined one or more group levels. If you want the data of other types of cube elements to be sorted, you should put the cube element into a banded object or table and make the data of the cube element inherit from the banded object or table.

You can achieve the above by using the Sort dialog, shortcut menu, or labels.

Using the Sort dialog

To set the sort conditions in the Sort dialog:

  1. Click Menu > Report > Sort (or the Sort button on the Analysis toolbar) to bring up the Sort dialog. See the dialog.
  2. From the Sort in Scope drop-down list, select a banded object/table or a group field on which the sort condition will be based.
  3. From the field drop-down list, select the field on which to sort the data, then set the sort order to Ascend or Descend.
  4. If you select a banded object/table in Step 2, you can click to add a new row of sorting condition if required. Click or to move a row up or down so as to set the sorting priority, to delete the corresponding sorting condition if it is unwanted.

    If what you select in the Sort in Scope drop-down list is a group field, then only one sort condition can be composed.

    To retrieve the opening status of this dialog, click the Reset button.

  5. Click OK to accept the settings and to reload the result.

Using the shortcut menu

To sort data on a certain field using shortcut menu:

  1. Point to any value of a detail field or group field by which to sort the data in the banded object/table, and then right-click.
  2. Choose the command Sort > Ascend or Sort > Descend from the shortcut menu.

    If what you right-click in Step 1 is a detail field value, the sorting will affect the order of detail records in the banded object or table; if it is a group field value, the order of groups in the group level represented by the group field will be rearranged.

To remove the sort condition on a field, click Sort > No Sort.

Using labels

You can use a label to control the sorting order for a certain field. This feature needs to be enabled at report design time.

  1. In JReport Designer, select a label in a banded object/table, and then set the Sortable property of the label to true.
  2. Set the field by which you want to sort records as the value of the label's Bind Column property.
  3. Save the report and publish it to JReport Server.
  4. Run the report in Page Report Studio, and you can click beside the label to sort the data. This button will change after you have clicked it, and you can further click it to switch the sorting direction among ascend, descend, and no sort.

Notes: