Jump to content
Changes to the Jaspersoft community edition download ×

check if the report is blank???


Recommended Posts

By: Rafael Barioni - rbarioni

check if the report is blank???

2003-06-25 04:57

Hello everyone....

 

I need to check if my report has no pages and then show a message to the user...

 

but I m generating reports in the Web and I only use a method to generate the HTML file with the report...

 

Is there any way to verify if it s blank??

 

thanx a lot

 

 

 

 

By: juan david vergara perez - jvergara

RE: check if the report is blank???

2003-06-25 06:14

of course...

if you have seted the whenNoDataType attribute with "NoPages"..

You can create a JasperPrint object and if this object have pages... you can export it to html o r what ever format.

 

JasperPrint jasperPrint= JasperFillManager.fillReport(source, parameters,datasource);

 

if (jasperPrint.getPages().size()>0)

//export the report

else

//show the user message

 

 

 

 

By: Rafael Barioni - rbarioni

RE: check if the report is blank???

2003-06-25 07:43

sure...

 

but I only use this method:

JasperRunManager.runReportToHtmlFile(source, destination, parameters, connection);

 

so I don t get a jasperPrint...I pass to the methos the jasper file from my compiled XML....I guess it s faster then compile the XML in runtime...

 

 

 

 

 

By: juan david vergara perez - jvergara

RE: check if the report is blank???

2003-06-25 07:51

look at the code of the method JasperRunManager.runReportToHtmlFile(source, destination, parameters, connection);

----->

public static void runReportToHtmlFile(

String sourceFileName,

String destFileName,

Map parameters,

Connection conn

) throws JRException

{

/* */

JasperPrint jasperPrint = JasperFillManager.fillReport(sourceFileName, parameters, conn);

 

JasperExportManager.exportReportToHtmlFile(jasperPrint, destFileName);

}

 

 

it's ok???

 

it's the same thing... you fill the report... ask for the pages number... an then invoke the method JasperExportManager.exportReportToHtmlFile(jasperPrint, destFileName).

 

Hope this helps!

 

 

 

 

 

 

By: Rafael Barioni - rbarioni

RE: check if the report is blank???

2003-06-27 04:29

thanx a lot, jvergara....

 

it worked fine here....

 

see u

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