jueves, 10 de septiembre de 2009

Tip 1: iReport - Crosstab - Orden de Datos

Al crear un Crosstab en iReport, vi la necesidad de indicar el orden de los datos a ser mostrados en las agrupaciones por columna, el crosstab de iReport por defecto ordena en orden alfabetico dependiendo del tipo de dato de la agrupación. Para cambiar esto, en la opcion de "Crosstab Data" que se muestra al dar click derecho sobre el Crosstab, se debe chequear "Data is pre-sorted" ademas de esto debemos cumplir con la siguiente regla al crear nuestro query:

crosstabDataset

Crosstab dataset definition.


Contains

dataset?


Attributes


isDataPreSorted

Flag that indicates whether the crosstab data is already sorted according to the row bucket expressions and group bucket expressions (in this order). The crosstab calculation engine can optimize the calculations if the data is sorted by the row groups and column groups. For example, if there are two row groups R1 and R2 (subgroup of R1) and three column groups C1, C2 and C3 the data should be sorted by R1, R2, C1, C2, C3.

Type:

Use: optional

Values

true
The calculation engine will assume that the data is presorted. If the data is not presorted, the outcome is undefined.
false
The crosstab dataset data is not presorted.

Default: false
  • Definición completa en: http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/schema.reference.html#crosstabDataset

Al hacer esto, ya tenemos el control sobre el orden en el cual se generarán las columnas o filas en el crosstab.