Jump to content
Changes to the Jaspersoft community edition download ×

subreport return value


Recommended Posts

hi everyone...im havin a problem in doing my reports which happen to have subreports..i want to know if this is possible..if my subreport returns null, i have a variable on main report which tells whether the subreport is null or not. thanks!!!
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Your subreport will have a value in the $V{REPORT_COUNT} variable at fill time, usually the count of rows returned by the source query. In the case of an empty report it will be either:



0 if you set the report's "When no data" setting to "AllPagesNoData"




null if it is set to BlankPage or NoPages



When you create the subreport control in you main report you wil need to pass the subreport's $V{REPORT_COUNT} variable's contents into your own variable (eg. $V{SUBREPORT_ROWCOUNT} ). This varable needs to be of type java.lang.Integer, have a default value expression of new java.lang.Integer(0), and have a calculation type value of "System". Its variable expression can be left blank.



From there it's up to you as to how you use the variable, and how you trap and handle a value of null if necessary.

Post edited by: jmurray, at: 2007/02/08 23:20

Link to comment
Share on other sites

  • 3 weeks later...


thanks for ur response..it helped a lot...anyways, i have another problem..i tried to copy the .jasper file to my project and generated it..it printed successfully but then i copied the jasper file from my project to the other pc im using..tried to generate it again and it dint print at all(im using the same parameters and the same database connection)...it said empty report...when i tried to recompile it to ireport and replace the existing file on my project to the other pc..it was printed...my question is...is it possible that a jasper file can or may be corrupted?? or do i have to recompile a precompiled file everytime i transfer it to another project??? what r the factors that may affect on the compilation of .jasper??? need ur advice...or opinion..thanks so much!!!!!

Post edited by: felcy, at: 2007/02/25 02:19

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