Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to Merge Table Rows With Repeated Values


    asimkin
    • Features: Reports Version: v6.4 Product: JasperReports® Server

    Issue Description

    I have a request to create a Table report and merge rows that have repeated values within the first column.

    Please find attached Excel sample that deminstrate the requirement

    mergedrows_excel.png.d0ea89010ad13ec5cb7bbe41d51c894b.png

    How to create such the report?


    Resolution

    Based on the nature of report datasource, it is possible to achieve the requirements either by using Crosstab component or by using 2 datasets and Table component.

    Let's review the second option.

    We will use 2 datasets - the main report dataset returns distinct values for the first column which should be grouped. The second dataset returns 'details' records for each value of the main dataset.

    Attached is a sample report based on SugarCRM sample database that demonstrates the idea.

    The main report dataset returns distinct list of values which are used to group data (countries in my example).

    I added corresponding TextField element into Details band, specify alignment and text rotation (Left).

    Also, the element 'Stretch Type' property set to 'Relative to Band Height' and 'Print Repeated Values' unchecked.

    Into the same band I added Table component based on the second dataset (Dataset1) which returns records for each country via parameter.

    reportdetails.png.5295c4e9cb387cc6e806c014772ac3ae.png

    As a result, I got required output, find attached printscreen.

    report_output.png.90c4188fad718c1323110db000d5a9b8.png

    Solution tested with TIBCO JasperReports® Server v.6.4.0


    Ref. Case 01553661

    reportdetails.png.ea56a1fd10c576ee192f57f0121b2b99.png

    tablemergedrows.jrxml


    User Feedback

    Recommended Comments

    I have implemented the same feature in my report but it also has alternate color styling for the rows. If i want to have a merged row with same color styling, how do i do that?

    Link to comment
    Share on other sites

    On 1/31/2024 at 10:43 PM, Hasib98 said:

    In my report it's not working. I exactly did the same but not working. Can any one help me to resolve this?

    agency_wise_coa.png

    Were you able to solve it? I have the same problem:(

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