Passing data from main dataset to table dataset

user715022 picture user715022 · Oct 9, 2014 · Viewed 8.9k times · Source

I'm creating simple report in Jaspersoft Studio 5.6.1 with one table.

Sending data to this report from Java via JRBeanCollectionDataSource.

In report I already can get this data vie fields: report-> DAtaset and Query... -> JavaBean Tab -> in Class Name write Java class, that comes in list in JRBeanCollectionDataSource -> add selected fields

So now I can display incoming data.

BUT if I want to do it in Table - I need to create Dataset (why?) and choose 'Use same connection used to fill the master report'. Adding same fields to new dataset doesn't help, neither choosing 'Connect to domain' for dataset. No errors displayed.

enter image description here

Answer

Darshan Lila picture Darshan Lila · Oct 10, 2014

I need to create Dataset (why?)

In Jasper Reports tables are loosely coupled to the main report, i.e a table requires its own dataset to deal with.

Now say, you have JRBeanCollectionDataSource ready for the report and you wish to use it to fill table with it. Table as I said requires its own datasert, does also require its own datasource.

Now you can either specify a datasource or use same connection to fill the table as that of main report.

For more on jasper report tables visit this link and on java part visit here.