Jump to content
JasperReports Library 7.0 is now available ×

Help needed with table splitting


petar.mitrovic

Recommended Posts

Hi,

 

I'll try to expose my problem as simplier as I can.

 

Imagine that you have to make a report which displays activities of each department in a company with many of them. Data must be grouped by a few main departments - something like this:

 

------------------------------

MainDepartment1 |

------------------------------

Department name | activities |

------------------------------

Department1.1 | 5 |

------------------------------

Department1.2 | 6 |

------------------------------

Department1.3 | 4 |

------------------------------

MainDepartment1 |

------------------------------

Department name | activities |

------------------------------

Department2.1 | 7 |

------------------------------

...

 

My problem is table header:

 

------------------------------

MainDepartment1 |

------------------------------

Department name | activities |

------------------------------

 

It should appear each time main department switches and at the top of new page. So I am placing it in my reports page header and group header. But the problem is when new group starts on a new page - my report displays 2 headers. I tried to use scriptlets, but I've got lost in them.

 

Any ideas... I'm listening.

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

You could get rid of the page header and use just group headers. You could then set your group to start on a new page when the group changes. The drawback to this approach is that you can end up with a lot of blank area when you have groups with not a lot of data.
Link to comment
Share on other sites

I already tried this, but as you suggested - there was a lot of empty space.

 

What I tried is using scriplets. I used a variable which says what is page header department id, and then used it in "print when" field of group header - if it is same, group header should not be displayed. I used afterPageInit() method to set variable value, but something was going wrong, because group header was shown even then. I feel I'm close to solve this, but I could still use some help.

Link to comment
Share on other sites

  • 1 month later...

As it ususally happens, I solve this problem by an accident when it was the last thing on my mind.

I was working on a report that required some group manipulation. While creating a group i noticed checkbox "Print header on each page".

So simple and on the other hand so difficult.

 

Regards,

Petar.

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