JasperReport: fisrt row in table component is missing

| January 9, 2012 | 0 Comments

carta_graficosWe are designing a report using JasperReport technology. One of the most commonly used component is the table component: a component that allow you to format a collections of data in a table format and can support as data source many differents types such as beans collections, sql connection,etc…

¿What is the problem?

We use as datasource a Java Bean Collection but is the same with others. When we execute the report, ther first row of the datasource is not show on the table component.

The cause is…

This is probably caused by the fact that you use to your table component  a  subdatasource as the one used by the master report. The data source expression of your reportwould look like this:

It is highly unlikely you really want to do that, since the table will move the record pointer in the data source it receives and thus will “consume” the master report data, making it end abruptly.

The most common situation where we face this problem is when the master report does not need to iterate on anything, but rather give the data source to one of its table (or subreports).

Such table could be placed on the title band of the master. The master report consumes the first record of the data source before passing it further to the table component, hence the observed effect.

And the solution is…

A solution to this problem could be add a first empty row to the datasource beforse pass it to the report.  This a simple solution with take small time to develop (probably one hour) althought is not the better solution (from an architectural and efficience point of view).


Reference sources:



Tags: , ,

Category: Others

Leave a Reply