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

  • SEARCH
  • Home
  • 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 8869697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:32:40+00:00 2026-06-14T17:32:40+00:00

I am generating a report from a JRBeanCollectionDataSource. This report is about a customer’s

  • 0

I am generating a report from a JRBeanCollectionDataSource. This report is about a customer’s order.

This is my code

public class Customer
{
    private String customerName;
    private String customerNo;
    private String customerAddress;
    private ArrayList<CustomerOrder> customerOrders;
    //Getters and Setters
}


private class CustomerOrder
{
    private String itemName;
    private BigDecimal amount;
    private int itemQuantity;
    //Getters and Setters
}

When a customer a report containing the customer details and a list of the customer orders need to be generated.
Since JRBeanCollectionDataSource takes a collection, this is what i did.

Customer cust; //Customer Instance

ArrayList<Customer> custList = new ArrayList<Customer>();
custList.add(cust); 

JRBeanCollectionDataSource rptData = new JRBeanCollectionDataSource(custList);

How can i extract the CustomerOrder list in Customer and pass it as a subreport?

  • 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-06-14T17:32:41+00:00Added an answer on June 14, 2026 at 5:32 pm

    You should be able to set the datasource expression for the subreport:

    new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{customerOrders})
    

    The resulting xml should have a subreport tag that resembles:

    <subreport>
        <reportElement uuid="e9fc4a60-3844-41b7-a38c-768f06f09b44" x="0" y="57" width="555" height="68"/>
        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{customerOrders})]]></dataSourceExpression>
        <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "report2_subreport1.jasper"]]></subreportExpression>
    </subreport>
    

    The only other thing you need to check is that the Language for the report properties is set to Java.

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

Sidebar

Related Questions

Using Crystal Report 8.5 Generating a report from table1 My Crystal Report Output ID
I am generating PDF/HTML report from a BIRT template. I am using visibility property
I'm generating a reporting services report from an ASP.NET (MVC) based application but am
When i am generating a report, I get java.sql.SQLException: ORA-08103: object no longer exists.Code
I am generating an automatically generated periodical report with Sweave. In order to create
I am creating table from code behind to show weekly report. It is working
I am generating a report in php (mysql), ex: `select count(id) as tot_user from
I am generating a report in my app. Now I want to send this
I'm having trouble on generating a report in MySQL. I have this table: CREATE
I am generating one PDF from the Code Behind File using StringWriter and HtmlTextWriter.

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.