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

whenNoDataType and printWhenExpression


cooperbry

Recommended Posts

Hello helpful people out there.  I have a report that specifies a noData section.  I also have a printWhenExpression that might exclude all data from the resulting report.  I would like to have the noData section appear if this condition occurs (that is, no data is displayed as a result of the printWhenExpression expression).  Is this possible?

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Unfortunately, I solved this by creating a counter variable inside the jrxml file.  It felt a little bogus having to do that, but, it seemed to have worked.  I added an expression that printed "No Data" when all rows were supressed.

 

I'll add a project request if I can figure out how...



Post Edited by cooperbry at 03/29/2010 10:23
Link to comment
Share on other sites

 Hi cooperbry,

 

No need to have counters and all the other stuff. Simply set whenNoDataType attribute to "allSectionsNoDetail" and in the Summary band Have a Text Field that displays "No Data Found" and in its printWhenExpression use the following expression:

 

DNV Srikanth

Code:
new java.lang.Boolean($V{REPORT_COUNT}.intValue()==0)
Link to comment
Share on other sites

======================================================================
Date Submitted:            03/29/2010 10:29
Last Modified:              04/09/2010 11:35
======================================================================
Summary:                    whenNoDataType and printWhenExpression
Description:
If a printWhenExpression is added to the detail band of a report and all
rows are suppressed based on the printWhenExpression during the report
execution, the noData section is not displayed.  It would be nice if Jasper
could detect that and display the noData section.
======================================================================

----------------------------------------------------------------------
(0009001) lucianc (administrator) - 04/09/2010 11:35

----------------------------------------------------------------------
The whenNoDataType attribute refers to the report dataset, while the detail
band is a layout item.  Those are conceptually different things, hence
using the noData band when the detail band doesn't print doesn't make sense
in my opinion.

If you want to filter records from the report data source, use the
report's filter expression.  The noData band will print when all records
are filtered.

I'm closing this as invalid.  Reopen if you have additional arguments.

Regards,
Lucian

Link to comment
Share on other sites

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