• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Jasper Reports - empty report

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have an application that uses Jasper Reports to show contents from a table onto a PDF file. (basically a select * from some table with a where condition)

This is my problem. When the sql returns data the PDF is shows up correctly. The PDF is generated even when the database does not return any rows. A message stating "The file cannot be opened because it has no pages" is shown on the screen.

How do I avoid an empty report to be displayed. The byte array returned is not empty so the the report pops up the pdf.

Can you help me capture an empty report???

Thanks for your help!!!

Chris Jose
 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When your query yields no results, there're 3 options that are provided by JR that you could make use of:
(a) generate empty report (PDF), i.e., no pages
(b) generate a single blank page report
(c) generate a report showing all sections, except the detail section

This can be done by setting the value of the attribute [B}whenNoDataType[/B] for element jasperReport. The 3 accepted values are:
(a) NoPages
(b) BlankPage
(c) AllSectionsNoDetail

Hope this helps.

Cheers!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to make a report without connectiing to database, only to pass parameters we want use in raport?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic