Jump to content
JasperReports Library 7.0 is now available ×

flexible report


bogdangh

Recommended Posts

Hello. I wonder if is possible with JR to make a report with a variable number of rows and columns (not a variable number of columns per row). Example :

 

user has a filtering criteria from which to choose:

 

Row1

Row2

Row3

 

and

 

Column1

Column2

Column3

 

if selected Row1 and Column1 :

 

----------Column1

------- ca1 --- ca2

Row1

--ra1--- V1 --- V2

--ra2--- V3 --- V4

 

 

if selected Row1 and Column1, Column2

 

------------------ Column1

-------------- ca1 --- ca1

----------- Column21----Column22

-------- cb1 --- cb2 --- cb3 --- cb4

Row1

--ra1--- V1 ----- V2 --- V3 ----- V4

--ra2--- V5 ----- V6 --- V7 ----- V8

 

 

The thing is that the number of rows/columns is flexible, the generated report could have 2 rows and 3 columns or 5 rows and 4 columns. Is this possible in JR ?

 

Thanks for any advice.

Bogdan

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Anyone with an answer ? Please, this is quite urgent.

 

Bogdan

 

PS: I have uploaded an image with how the report should look like. Can someone tell me if this can be done with JR ?

 

Post edited by: bogdangh, at: 2006/11/21 17:07 [file name=img.gif size=49724]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/img.gif[/file]

Post edited by: bogdangh, at: 2006/11/21 17:08

Link to comment
Share on other sites

Hi,

 

What you are saying is that at report design time you do not know the structure of the crosstab, because it depends on what the end user selects.

This is similar to saying: I want to do a report with groups, but I don't know the groups right now, I'll know them when the end user will picked them.

This means you do not have a static report template that you could create using iReport, but rather a dynamic report template that you could build at runtime using the JasperReports API based on end user selection.

 

You can see how dynamic report templates could be created using the JR API by looking at the supplied /demo/samples/noxmldesign sample provided with the project.

In your case it is the crosstab that has an unknown structure, but I guess you end up building the whole report using the API.

Mixed solutions are also possible, in which you design most of the report using iReport and then at runtime you load it and add pieces to it (the crosstab) using the API as indicated.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

Yes, this is the situation. First i though that i can hide/collapse the unwanted rows/columns from the crosstab but found out that is not possible and finally i got to your solution, building the report dynamically.

 

My solution is to make a jrxml template with all the rows/columns that the user can choose, based on this to get the JasperReport object and than, based on the real criteria that was selected, to eliminate the unnecessary rows/columns and related info.

 

Bogdan.

 

Post edited by: bogdangh, at: 2006/11/23 11:26

Post edited by: bogdangh, at: 2006/11/23 11:27

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