Sunday, 15 September 2013

Adding subreports to master report at runtime (java) -



Adding subreports to master report at runtime (java) -

alright, couldn't find reply question google so...

currently i'm using jasperreports , dynamicjasper build reports , print them. works fine when utilize single jasper-files or jrxml-files. have piece of code merges jasperprint-files 1 if need combine reports. however, isn't optimal...

can utilize 1 .jasper or .jrxml-file master study (it has header, footer , en empty detail-band) , fill detail-band 1-n subreports (currently in .jasper or .jxrml)?

currently 1 of wannabe subreports utilize datasource (tablemodel) , other wannabe subreports info parameters.

i've found several different ways end result want, far no success... builders/managers/whatever need? getting bit frustrated because can't find plenty info different classes, methods , parameters. why there , required. examples don't explain enough...

should utilize dynamicreportbuilder build dynamicreport dynamicjasperhelper generates jasperreport in turn filled jasperfillmanager.fillreport method?

have sub reports in 1 main study , utilize print when expression visibility. next subreport code.

<subreport> <reportelement uuid="9f36c3cb-7e29-4040-a14e-6a91775e89e4" x="0" y="35" width="555" height="47"> <printwhenexpression><![cdata[$p{disp} == 1]]></printwhenexpression> </reportelement> <!-- other element --> </subreport>

look out next line in above code.

<printwhenexpression><![cdata[$p{disp} == 1]]></printwhenexpression>

this means whole of sub study should included on when $p{disp}.intvalue() == 1. here $p{disp}, parameter have pass study in order work printwhenexpression.

parameters or not necessary, can utilize field well. , conditions based on requirement.

note : can have simillar approach subreports.

java jasper-reports subreport dynamic-jasper

No comments:

Post a Comment