Jump to content

Creating pivot tables


2006 IR Open Dicussion

Recommended Posts

By: Stephen Hughes - srhughes

Creating pivot tables

2006-05-11 01:54

Hi, I would like to create a dynamic pivot table in iReport using a crosstab. I would like to pass parameters to the main report (using JasperServer) and then pass the parameters to the crosstab. I want to choose the fields to display in the left column, top row and then the rest of the table. So for example, I have a database showing sports sales in each quarter thoughout the year (by quarter). Sales can be in Tickets, Equipment or Training. What I want to do is have one report that can ask for the data to display (ie show a table with sport vs quarter with sales in the main table, or Equipment vs quarter with sales in the main table). This needs to be one report since I have many fields which I would like to compare.

 

Is there any way to do this in iReport? I have set up a crosstab already and can pass parameters, but the crosstab fields seem to remain static even when I change the input parameter.

 

Thanks

Stephen

 

 

 

 

By: Stephen Hughes - srhughes

RE: Creating pivot tables

2006-05-16 03:57

I solved this problem by using Groovy ternary statements, with a conditional string comparison statement to test if the parameter entered was "ABC". If this was true, then the bucket expression was $F{ABC}. Else, it was $F{XYZ}. Any number of conditions can be nested, although it gets rather long and difficult to manage. A switch may be better (if iReport supports this!)

Link to comment
Share on other sites

  • 2 years later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 year later...

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...