check if the report is blank???

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
2006 IR Open Discussion's picture
Joined: Aug 10 2006 - 3:29am
Last seen: 16 years 7 months ago

0 Answers:

No answers yet
Feedback