Jasper Reports Groups and Columns
Is there a way to change the Columns of a group based on a field?
I have the following dataset: [Name, Type, Field]
Which I want it to 开发者_StackOverflow社区show this kind of group for type = 1:
Name Money
Bob 1
Jen 2
For type = 2:
Name Number of Cars
Clarkson 10
James 2
Is there a way to get the column to chance the text based on the field?
You can't change label If you're using a Java bean as a data source, I would recommend making type
a String. When you go through and set values in the beans, you can check for type == 1
, type == 2
, etc. and set the String accordingly.
The only other way I can think to do it off the top of my head is to create 1 set of report objects for each type of data, and to create 3 templates, 1 per band, in iReport. Then you can show/hide report tables based on what you have data for. If you're not going to show all 3 datasets in 1 report, I recommend the first option as this way of doing things is too much work for what you'd be getting out of it.
精彩评论