Jump to content
We've recently updated our Privacy Statement, available here ×

Sub Reports


pnvswamy

Recommended Posts

  • 2 months later...
  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

 

i am also having some problem with subreport. i used netbeans for development tool and i execute a report which got a subreport from the application and it worked fine. The problem it when i pass a parameter for the report and no data is being fetched. Can anyone help me with this.

Thanx

Link to comment
Share on other sites

  • 4 months later...

Another old thread that is incomplete, so I'll try to complete it.

The answer was almost given above, but a few details were not quite correct, which might explain why the original poster did not recognize the solution.

First, your main collection class should look similar to this:

Class EmpDetail {

String empCode;

String empName;

List ProjectDetails empDetails;

}

Notice the list/collection in your main class which will contain the source of data for the sub-report.

Then, in the main report where you define your subreport, set the Data Source Expression property to the following:

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

The reference to field empDetails was key to understanding the solution and was not presented before.

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