Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6059857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:45:33+00:00 2026-05-23T08:45:33+00:00

I have a need to create a report in DynamicJasper that has multiple subreports

  • 0

I have a need to create a report in DynamicJasper that has multiple “subreports” which contain different columns. The data for the columns is stored in a HashMap on each row Object. I have not found any way in DynamicJasper to specify that a column’s value should come from a particular key on the HashMap.

I have found that if I build a single report, I can extend JRAbstractBeanDataSource and create my own Data Source that knows how to get the data correctly based on how I format the field name. However, when I use addConcatenatedReport to add in multiple reports, the “subreports” use JRBeanCollectionDataSource instead of my custom Data Source.

The only solution I have come up with so far is to have a POJO that has a bunch of properties like “column1value” and “column2value” which I preload and use for the field references in the dynamic columns. I really don’t want to do this…can anyone think of any other options? Anything I am missing?

Sidenote: any ideas why you can’t pass a custom data source type to the addConcatenatedReport function? Technical issues, or it just hasn’t been needed? Seems like this would be a common need for a “dynamic” report.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:45:33+00:00Added an answer on May 23, 2026 at 8:45 am

    I was searching for the same thing yesterday and I came across your post (and I saw it was recent). After some search I managed to overcome this problem so I thought it would be nice to share with you my findings.

    I suppose that you defined an POJO for your data and then added all these objects to the HashMap (correct me if I am right).

    What I did was to create a new Object that extends HashMap implementation. (In fact you dont have to extend this, you can use the HashMap object itself). So now instead of having objects inside HashMap I directly inserted values for the properties. But lets just add some code blocks in order to clear things 🙂

    Suppose that you have the following PoJO

    public class MyPOJO{
    
      private String name;
      private String value;
      //getters, setters etc..
     }
    

    Instead of adding these various objects to a List and providing it as datasource you can use a HashMap this way to define your objects:

    Map<String,String> myObject1=new HashMap<String,String>();
    myObject1.put("name","Name1");
    myObject1.put("value","Value1");
    
    Map<String,String> myObject2=new HashMap<String,String>();
    myObject2.put("name","Name2");
    myObject2.put("value","Value2");
    

    After defining these objects we can add them in a List and provide it as datasource (JRBeanCollectionDataSource). So the keys of each HashMap are considered to be the properties defined in the Columns (the properties of the initial POJO).

    I dont know if my solution is the best but it worked for me!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple reports that take the same parameters. Need to create a master
I have a need to create a transactional process using an external API that
We have a need to create a private key that is seeded from 2
I have a XML schema that I will need to create Java classes for.
I have a third-party app that creates HTML-based reports that I need to display.
I have the need to create the functionality to allow my registered users to
For part of my application I have a need to create an image of
I have several web services I need to create for them some testing mechanism
I need to create a Firebird Database programmatically using DBExpress. I have done this
I have the need to take a string argument and create an object of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.