whenNoDataType and printWhenExpression

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?

cooperbry's picture
108
Joined: Oct 14 2008 - 11:20am
Last seen: 14 years 11 months ago

5 Answers:

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
cooperbry's picture
108
Joined: Oct 14 2008 - 11:20am
Last seen: 14 years 11 months ago

Here's a bogus test report that uses variables.  You can use the variables to display a "No Data" message.  It works...

cooperbry's picture
108
Joined: Oct 14 2008 - 11:20am
Last seen: 14 years 11 months ago

 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)</td></tr></tbody></table>
dnvsrikanth's picture
Joined: Jul 22 2007 - 1:29pm
Last seen: 4 years 10 months ago

thanks

cooperbry's picture
108
Joined: Oct 14 2008 - 11:20am
Last seen: 14 years 11 months ago

======================================================================
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
http://jasperforge.org/plugins/mantis/view.php?id=4659#c9001
----------------------------------------------------------------------
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

cooperbry's picture
108
Joined: Oct 14 2008 - 11:20am
Last seen: 14 years 11 months ago
Feedback