Jump to content
Changes to the Jaspersoft community edition download ×

subreport - DataSource called out of sequence


2004 IR Help

Recommended Posts

By: Mark Alguard - malguard

subreport - DataSource called out of sequence

2005-10-04 13:50

I have been using JasperReports for quite a while, very successfully. Recently we have seen a problem where sometimes the data from a subreport does not display, particularly when it is assciated with the first record on a page (not page 1). I use our own version of JRDataSource. When I put some println's in the next() method, I see that JR is calling next(() for another record in the SR, even after next() has already returned false. Also, there are 2 subreports, and when the problem happens I can see that JR starts trying for data on the second, before next()=false has been returned for the first. For main report records where everything displays correctly, the println's show that the first subreport's records are exhausted (next=false returned) before it starts on the second subreport.

 

In the following partical printout, record 4 prints at the bottom of page 1 and is ok. Record 5 prints at the top of page 2, but shows no data from one SR and partial data from the other.

 

MyJRDataSource@121b6e7 next()=true. Found next top-level record for id=4

12:15:37,476 INFO [sTDOUT] MyJRDataSource@15a4043next()=true. Found next matching subreport record for 4

12:15:37,496 INFO [sTDOUT] MyJRDataSource@15a4043next()=true. Found next matching subreport record for 4

12:15:37,496 INFO [sTDOUT] MyJRDataSource@15a4043next()=false. No more subreport records for 4

12:15:37,506 INFO [sTDOUT] MyJRDataSource@80a576next()=true. Found next matching subreport record for 4

12:15:37,506 INFO [sTDOUT] MyJRDataSource@80a576next()=true. Found next matching subreport record for 4

12:15:37,516 INFO [sTDOUT] MyJRDataSource@80a576next()=true. Found next matching subreport record for 4

12:15:37,516 INFO [sTDOUT] MyJRDataSource@80a576next()=false. No more subreport records for 4

12:15:37,516 INFO [sTDOUT]

MyJRDataSource@121b6e7 next()=true. Found next top-level record for id=5

12:15:37,576 INFO [sTDOUT] MyJRDataSource@15a4043next()=true. Found next matching subreport record for 5

12:15:37,586 INFO [sTDOUT] MyJRDataSource@15a4043next()=true. Found next matching subreport record for 5

12:15:37,586 INFO [sTDOUT] MyJRDataSource@15a4043next()=true. Found next matching subreport record for 5

12:15:37,596 INFO [sTDOUT] MyJRDataSource@15a4043next()=true. Found next matching subreport record for 5

12:15:37,596 INFO [sTDOUT] MyJRDataSource@80a576next()=true. Found next matching subreport record for 5

12:15:37,606 INFO [sTDOUT] MyJRDataSource@80a576next()=true. Found next matching subreport record for 5

12:15:37,606 INFO [sTDOUT] MyJRDataSource@80a576next()=true. Found next matching subreport record for 5

12:15:37,606 INFO [sTDOUT] MyJRDataSource@80a576next()=false. No more subreport records for 5

12:15:37,656 INFO [sTDOUT] MyJRDataSource@15a4043next()=false. No more subreport records for 5

12:15:37,666 INFO [sTDOUT] MyJRDataSource@80a576next()=false. No more subreport records for 5

12:15:37,666 INFO [sTDOUT]

 

Any guidence is appreciated. I have played quite a bit with heights, positions, etc., and sometimes it seems to help, but it seems that the problem just becomes less frequent or moves to another page.

 

 

 

 

By: Teodor Danciu - teodord

RE: subreport - DataSource called out of sequ

2005-10-05 01:52

 

Hi,

 

What version of JR are you using?

Have you placed the subreports into a band with

isSpliAllowed="false"?

 

Thank you,

Teodor

 

 

 

 

 

By: Mark Alguard - malguard

RE: subreport - DataSource called out of sequence

2005-10-05 07:20

I was using version 0.6, but updated now to 1.0.2 in the hope that it was a bug fixed in the newer version. Unfortunately, the symptoms didn't change.

The subreports are in the detail band of the main report, where isSplitAllowed is set to "false". All of the bands on the subreports have this switch set to "true", which I assume is irrelevent since the page size there is much bigger than will be used for a single SR instance.

I use JasperAssistant for the designer tool - and don't look at the jrxml directly very often.

 

 

 

 

By: Teodor Danciu - teodord

RE: subreport - DataSource called out of sequ

2005-10-05 08:03

 

Hi,

 

Your subreport data source should implement the

JRRewindableDataSource interface.

On the moveFirst() method in your data source

implementation, do you move the record pointer back

to the first record?

 

Thank you,

Teodor

 

 

 

 

 

By: Mark Alguard - malguard

RE: subreport - DataSource called out of sequ

2005-10-08 08:58

Thanks, Teodor. I converted my JRDataSource to implement JRRewindableDataSource, adding the moveFirst() method and it works! It was complicated: I had to add caching to the next() method because the ultimate data source is not rewindable in our case. Somehow, I have missed seeing in the documentation about when you have to use the rewindable class. Can you explain that, or point me to the right document. Thanks again!

 

 

 

 

By: Lucian Chirita - lucianc

RE: subreport - DataSource called out of sequ

2005-10-10 00:38

Hi

 

Rewindable data sources are required for subreports placed on a band which is not allowed to split. If the band doesn't fit on the current page, the band filling would be restarted on the next page and the subreport datasource would be rewound to the first row.

 

Regards,

Lucian

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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