Table or Crosstab report design


I'm starting with Jasper Reports and I have a use case that I'm finding difficult to solve. The report I want to design should be like this:

  Account 1 Account 2 ... Total
Previous Balance        

Where Column Headers are dynamic depending on the number of Accounts defined and the three Row Headers (Previous Balance, Income, Expense) will always show in the report even if some Account has a nullor 0value in any of them. The Balance at the end would be the result of Previous Balance + Income - Expense

I first watched how Crosstab works as the report is a matrix where I can get the Total in any of the two ways (through sum of Balances or applying the Balance formula to the Total column), but what I'm not understanding is how could I make the Rows headers fixed. Should I use some variable that I set by hand? Any hint on what to read will be a great help.

The other approach I suppose it would be feasible is using a table where the row headers of the diagram would be the columns and Accounts the rows. Balance is easily defined same as total. The only thing I don't know if it's possible is turning the columns to rows and viceversa (transposing the table). What do you think, is this approach better? If so, is it possible to transpose the table? what's the JRXML attribute to do so?


maureyeslopez's picture
Joined: Dec 9 2013 - 12:19pm
Last seen: 1 year 11 months ago

2 Answers:



Here is a link to get you started, a quick tutorial.


Java_Jasper's picture
Joined: Jan 17 2012 - 10:13am
Last seen: 1 year 1 month ago

I ended up using a normal table with rows displayed horizontally and not vertically as I was planning.

maureyeslopez's picture
Joined: Dec 9 2013 - 12:19pm
Last seen: 1 year 11 months ago