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

How to use print when expression for no rows


ktalarico

Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

The Print When expression you would use is something like this:

 

 

new java.lang.Boolean($V{REPORT_COUNT}.intValue()==0)

 

 

But be careful: the value of REPORT_COUNT is not available until AFTER the detail section has been filled. That means that you can normally only use that expression in a footer or summary section.

 

 

There is a way around the problem though. You can use a subquery to return the value BEFORE the detail section is filled because subreports are always filled first. The subreport doesn't need to display anything, it just returns the value of REPORT_COUNT so that you can store it in your own variable within the main report. The subreport's query is the same as the query in the main report.

 

 

The best place to put it is in a header section, out of the way. Once your variable has the value of REPORT_COUNT from the subreport you can use it in any subsequent band, including the Detail band. The expression now has to refer to your own variable:

 

 

new java.lang.Boolean($V{yourVariable}.intValue()==0)

Link to comment
Share on other sites

  • 3 weeks later...

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