bogdangh Posted November 21, 2006 Share Posted November 21, 2006 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: Row1Row2Row3 and Column1Column2Column3 if selected Row1 and Column1 : ----------Column1------- ca1 --- ca2Row1--ra1--- V1 --- V2--ra2--- V3 --- V4 if selected Row1 and Column1, Column2 ------------------ Column1-------------- ca1 --- ca1----------- Column21----Column22-------- cb1 --- cb2 --- cb3 --- cb4Row1--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 More sharing options...
bogdangh Posted November 21, 2006 Author Share Posted November 21, 2006 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 More sharing options...
bogdangh Posted November 22, 2006 Author Share Posted November 22, 2006 A yes or no will just make my day. Can anyone help me ? Teodor ? B. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 23, 2006 Share Posted November 23, 2006 Hi, What you need to know is that people call this kind of table you showed us a "crosstab". I hope I made your day today.Teodor Link to comment Share on other sites More sharing options...
bogdangh Posted November 23, 2006 Author Share Posted November 23, 2006 That much i understood. My question remains if it is possible with JR to make from the same jrxml template a report that has it's rows and columns decided by user input from a given criteria (as shown in the example). Bogdan. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted November 23, 2006 Share Posted November 23, 2006 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 More sharing options...
bogdangh Posted November 23, 2006 Author Share Posted November 23, 2006 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:26Post edited by: bogdangh, at: 2006/11/23 11:27 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now