Home Ask Login Register

Developers Planet

Your answer is one click away!

Frantumn February 2016

Why bother creating the first dataset when using table component?

I've been trying to use Jasper Reports Studio 6.2 and am struggling to understand the Datasets.

I don't understand why I'm asked to create a dataset when I create a new report, then asked to create another new dataset when I add a 'table' object. I don't get the first one... in my mind, the one that's associated with the creation of the 'table' object would have the SQL query, and be the data object. If that's the case, what was the point of creating one at the beginning?


Petter Friberg February 2016

The data-source for the report will iterate on the reports detail band

The data-source for the table will iterate the rows on your table.

If you have only a table in the report you can

  • Pass an JREmptyDataSource example new JREmptyDataSource(1), this will show detail band once


  • Put the table in for example the summary band and set the attribute whenNoDataType="AllSectionsNoDetail" on the jasperReport tag and then pass no datasource to the fill manager.

Why can both be useful?, the first you use to show data using the normal detail band and the second one you use to show for example a table that sums up data on the summary band

Post Status

Asked in February 2016
Viewed 3,968 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life