Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic Columns [duplicate]

I need to create a report where the number of columns changes based on the data being passed to iReport just like with a subreport. Is there a way to do this?

like image 688
Graham Avatar asked Apr 04 '11 21:04

Graham


1 Answers

I agree with Ischin's answer, but I will elaborate.

The Crosstab Report will allow you to have dynamic columns because it allows you to pivot your data. You can select one or more fields to group by to create the columns. The values of the groups become the labels for the columns and then you must use aggregate functions for the values in the report called Measures (e.g., sum or count). If you select more than one field, you will have multiple levels of columns. When you design the report, you pick the size of the columns--they must all have the same size.

JasperReports is a product designed for creating something that will print on a piece of paper consistently, like a PDF. iReport as of at least version 5.1.0, does not have any other way to truly dynamically create columns. You could write in logic to show or hide columns based on parameters, but this would be very tedious and does not fit in with what JasperReports is designed for. It would be very difficult, for example, to allow the user running the report to select parameters that allow the user to control which columns are in the report and the positions of the columns.

like image 168
user1352689 Avatar answered Oct 01 '22 02:10

user1352689