Jump to content
Changes to the Jaspersoft community edition download ×

Row count in lastpage of crosstab


Recommended Posts

I need to add the number of rows returned in last page of crosstab report.

I tried various ways using the cross tab variables, but it is always returning the no. Of rows * no. columns.


For ex. Columns are 30

Rows are 52

Report is returning 1560 instead of 52 at the end.

This is very urgent. Can somebody help me?

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Could you clarify what are you trying to achieve?


More specifically:

- What do you mean by "number of rows returned"? I guess it's the number of rows in the crosstab, but does it include total rows or only detail rows?

- Where exactly do you want to display this number ("last page of the crosstab report" is too vague)? Is it inside the crosstab (in the grand total row), or outside the crosstab (in the report)?




Link to comment
Share on other sites

I see that you want to show the number of crosstab rows and columns outside the crosstab. There is no straightforward way to do this, but it still can be achieved.


For example, you can use a java.util.Map object to return these values from the crosstab. More specifically, you can do something like this:

- create a java.util.Map variable "CrosstabReturnMap" having calculation="System" and new java.util.HashMap() as initialValueExpression

- pass the map to the crosstab as a parameter:

<crosstabParameter name="ReturnMap" class="java.util.Map">



- in the crosstab row and group headers, put the current row/column number in the map using a dummy expression: $P{ReturnMap}.put("Rows", $V{ROW_COUNT})

- in the text element, extract the values from the map: $V{CrosstabReturnMap}.get("Rows"). Note that if the text element is placed on the same report band as the crosstab, you'll need to set evaluation="Band"




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...