Jump to content
We've recently updated our Privacy Statement, available here ×

When no data


2004 IR Help

Recommended Posts

By: eileene_c - eileene_c

When no data

2005-05-05 17:54

Hi, anyone know how to do this?

 

I need to show the page header and a fixed text, "No Data Found" whenever no rows are retrieved.

I tried using the PrintWhenExpression.

I put in "new Boolean(REPORT_COUNT.intValue()>0)" in the column header and detail bands.

and ""new Boolean(REPORT_COUNT.intValue()==0)" in the summary band where "No Data Found" text field is.

 

The problem is, when there is data, the column header doesn't show because the value of REPORT_COUNT in that band is still 0. Is there any other expression i could use aside from REPORT_COUNT?

 

Thanks in advance.

 

An alternative we're looking into is creating 2 jrxml files, 1 with column header and detail and the other with the "No Data Found" text. Then control which to call in the java class.

First call the "with data" jrxml. Then check if (jasperPrint.getPage().size==0), call the "no data" jrxml. But this would be like hard-coding it.

 

 

 

 

 

By: jorge - sirion_oef

RE: When no data

2005-05-06 12:03

what datasource are you using? how are you filling it?

 

if you fill it in your application you could calculate if it is empty and send a parameter to the report indicating this, and use that parameter for show or not everything you want.

 

 

 

 

By: Ionut Nedelcu - ionutned

RE: When no data

2005-05-09 05:21

If you set the whenNoDataType attribute to "NoPages" and check for getPages().size(), you can easily forward it to any other page, even a nice formatted generic error HTML page, I see no reason for creating 2 jrxml files.

 

 

 

 

By: mmatlack - mmatlack

RE: When no data

2005-05-09 06:55

For the column header and detail band Print whenExpression can you use a field and check for null or and Integer field and check the intValue()? Then use the printWhenExpression

new Boolean(REPORT_COUNT.intValue() ==0) on the report footer or summary band for the "NO Data message"?

 

 

 

 

By: eileene_c - eileene_c

RE: When no data

2005-05-09 18:16

jalbert: tnx for your suggestion. i think we could try that out too. but i'd like to keep the checking within the tempalte/jrxml as much as possible. thanks again.

 

mmatlack, i tried your suggestion. it worked. i used one of the fields and checked if it is null in the column header band. and still check for REPORT_COUNT in the detail and summary band (where "No Data" is).

 

ionut: output is in text file, we're launching the java class calling the report in unix. if we go for checking No pages using getPages.size(), we'd create a generic jrxml for "No Data". Thanks.

Link to comment
Share on other sites

  • 6 years later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

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