Jump to content
Changes to the Jaspersoft community edition download ×
  • Custom Crosstab ordering iReport Designer


    nbochenko
    • Features: Reports Version: v4.7, v4.7.1, v4.7.0

    Question Description

    How do you change default ordering/sorting of crosstab? For example, if you have product_id and product_name and would like to order by product_id, not by product_name.

    Solutions

    Sort in report query

    You can pre-sort your data in your query. For example, use "ORDER BY product_id" clause. You would need to check "Data is pre-ordered"  checkbox in table properties for this to work.

    Note that if you have a complex corsstab, you may need add all sorts of ORDER BY clauses to your query.

    Crosstab group

    Create two crosstab groups, the first using product_id  as key and the second using product_name. The first group would have no/zero width header.

    Use "Order by..."

    The order by expression can be used to order crosstab groups based on measure totals, for example, $V{POSITIONS_QUANTITYMeasure}. You could use it to order the groups on product id by adding product id as a measure with calculation=Nothing/First

    See http://jasperreports.sourceforge.net/schema.reference.html#orderByExpression for more details

    Use a custom comparator

    You would need to create a custom Java Class that holds both the value you are ordering by and a value you are displaying.


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...