nsanagari Posted May 12, 2009 Share Posted May 12, 2009 Hi, From the last few days i am workin on the Jasper reports and ireports using the JavaBean Set data source. I can generate the report which has static coloums in the report. I dont know how to generate report which has dynamic colouns based on the data given to the report. Can any one tell me how to generate the report which has dynamic colouns. Thanking you,NIRANJAN REDDY. S Link to comment Share on other sites More sharing options...
phantastes Posted May 13, 2009 Share Posted May 13, 2009 Hi,it sounds like you will need to use a crosstab. The crosstab will generate a dynamic number of columns that are based on what type of value you use horizontaly. For example if you have a POJO with values:String monthString typeOfIncident By setting the horizontal value in the crosstab to month and the vertical to typeOfIncident you can get the following resut:Incident Jan Feb March AprilA 4 5 4 3B 10 3 12 5C 12 3 34 2Total 26 11 40 10There is a lot more that you can do with crosstabs so try it out. They are a very powerful tool to use in your reports.I hope this is somewhat clear.Magnus Post Edited by phantastes at 05/13/2009 17:15Post Edited by phantastes at 05/13/2009 17:16 Link to comment Share on other sites More sharing options...
nsanagari Posted May 14, 2009 Author Share Posted May 14, 2009 Hi, Thankyou for your reply.I am using Java bean set datasource as Report datasource in iReports 3.5.0. Can you give an example how it can be done. Link to comment Share on other sites More sharing options...
phantastes Posted May 14, 2009 Share Posted May 14, 2009 Well if you have managed to create a report with static columns you will have set a number of Fields, right? Now, create a crosstab object (start with putting the crosstab in the summary band). Then set the Fields you want to use in the crosstab. Let's say you have a list of the objects I mentioned above where each object has two parameters:String monthString typeOfIncidentNow by setting these as Fields in iReport and using these fields in the crosstab you will get a dynamic number of columns based on the number of different months you have in your data. I hope this helps somewhat. Magnus 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