Reputation: 83
I have created a crosstab in Jasper Studio which shows Sales, Quantity, and Percentage Margin totals for a client. The major complexity of this crosstab is the Percentage Margin, as this cannot use a simple sum, count, or average in the total to report the correct figure, it needs to be calculated separately. To combat this I have created 4 measures:
The client requires the crosstab to be sorted at runtime using the interactive sorting feature of Jasper Server. This is working, but only as long as the crosstab uses one measure. As soon as I add the other 3 measures, the sorting option for all columns greys-out, and the sort no longer works for the client.
Is there any way I can make this sorting work, even when I use multiple Measures? Or is there another way I can display the information I require using a single measure instead?
Upvotes: 0
Views: 1570
Reputation: 5093
What you need to do is to set the net.sf.jasperreports.crosstab.column.header.sort.measure.index property on an element in the column header cell to the 0-based index of the measure that you want the column sorted by.
As in
<columnGroup ...>
...
<crosstabColumnHeader>
<cellContents>
<textField>
<reportElement ...>
<!-- sort by the second measure -->
<property name="net.sf.jasperreports.crosstab.column.header.sort.measure.index" value="1"/>
</reportElement>
Upvotes: 0