Jump to content
JasperReports Library 7.0 is now available ×

Recommended Posts

By: Michael Rimov - rimovm

Blank report?

2003-10-05 04:11

Hey All!

 

Came across a strange anomaly that I wanted to post here:

 

If a report is compiled that doesn't have a query associated with it. If I pass in a java.sql.Connection object, then a blank report is generated!

 

So I was able to solve it by:

 

JRQuery query = report.getQuery();

 

if (query == null) {

JasperManager.fillReportToFile(report,

tempFile.getAbsolutePath(), getReportParameters(),

new JREmptyDataSource());

} else {

JasperManager.fillReportToFile(report,

tempFile.getAbsolutePath(), getReportParameters(),

con.getConnection());

}

 

However, it just seemed really strange that the report filler would care about the datasource if there was no query. If it's a bug, I wanted to point it out (JR 0.5.0), and if not, hopefully it'll help somebody else working with it!

 

Thanks for a fine library!

 

-Mike ®

 

 

 

 

By: Teodor Danciu - teodord

RE: Blank report?

2003-10-05 04:34

 

Hi,

 

This is the intended behavior.

Why would someone expect the reporting engine

to iterate over some records when a connection

object was supplied, but inside the report there

is no query.

 

However, you might consider using

whenNoDataType="AllSectionsNoDetail" for your

report, if you want the engine to generate something

even when there are no records in the data source.

 

Thank you,

Teodor

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