Merge several reports / have several report chapters -
how can merge or concatenate several jrxml jasperreports 1 report unit,
without using java code?
i can upload jrxml files , generate report units rest api / webservice only.
or there other solution element layout?
--header-- * group of countries england australia croatia * pie chart countries --footer-- --new page-- --header-- * group of else 1 else 2 .... * chart of else --footer--
i think of having array variable iterate on <group>
element , print sub report each element. like:
<variable name="chapters" class="java.util.list" resettype="none" resetgroup="chaptergroup" incrementtype="group" incrementgroup="browsergroup"> <variableexpression> <![cdata[java.util.arrays.aslist("browser", "country")]]> </variableexpression> <initialvalueexpression> <![cdata[new java.util.arraylist()]]> </initialvalueexpression> </variable> <group name="chaptergroup" isstartnewpage="true" keeptogether="true"> <groupexpression><![cdata[$v{chapters}]]></groupexpression> <groupheader> <band height="20" splittype="stretch"/> </groupheader> <groupfooter> <band height="20" splittype="stretch"> <subreport> <reportelement isprintrepeatedvalues="false" x="5" y="25" width="325" height="20" isremovelinewhenblank="true" backcolor="#ffcc99"/> <subreportparameter name="<![cdata[$v{chapters}]]>"> <subreportparameterexpression><![cdata[$v{chapters}]]></subreportparameterexpression> </subreportparameter> <connectionexpression><![cdata[$p{report_connection}]]></connectionexpression> <subreportexpression class="net.sf.jasperreports.engine.jasperreport"><![cdata["repo:/reports/" + $v{chapters}]]></subreportexpression> </subreport>
but can't work..
using jasper report server 5, (i code jrxml myself, , use ireports preview). same datasource everything, 2 queries 2 grouping sections charts.
this can done adding report groups, can add many report groups want per chart , keep header , footer in same report group every chart , every report group have sub dataset. have combined 5 report different header , footer.
you can see sample report provided jaspersoft name " standard chart report" under reports directory.
to :- 1:- add dataset 2:- add report group 3:- drag chart palette
here code sample, in code sample combining bar chart , stacked bar chart in 2 pages 2 different sub dataset :-
<group name="bar"> <groupexpression><![cdata[null]]></groupexpression> <groupheader> <band height="400"> <barchart> <chart evaluationtime="report"> <reportelement x="0" y="0" width="555" height="300"/> <charttitle> <titleexpression><![cdata["bar chart"]]></titleexpression> </charttitle> <chartsubtitle> <subtitleexpression><![cdata["chart displaying bars"]]></subtitleexpression> </chartsubtitle> <chartlegend/> <hyperlinktooltipexpression><![cdata["bar chart"]]></hyperlinktooltipexpression> </chart> <categorydataset> <dataset incrementtype="group" incrementgroup="salesstate"> <datasetrun subdataset="categorydataset"/> </dataset> <categoryseries> <seriesexpression><![cdata[$f{sales_state}]]></seriesexpression> <categoryexpression><![cdata[$f{full_name}]]></categoryexpression> <valueexpression><![cdata[$v{personamount}]]></valueexpression> </categoryseries> </categorydataset> <barplot> <plot/> <itemlabel/> <categoryaxislabelexpression><![cdata["name"]]></categoryaxislabelexpression> <valueaxislabelexpression><![cdata["amount"]]></valueaxislabelexpression> </barplot> </barchart> </band> </groupheader> </group> <group name="stackedbar"> <groupexpression><![cdata[null]]></groupexpression> <groupheader> <band height="400"> <stackedbarchart> <chart evaluationtime="report"> <reportelement x="0" y="0" width="555" height="300"/> <charttitle> <titleexpression><![cdata["stacked bar chart"]]></titleexpression> </charttitle> <chartsubtitle> <subtitleexpression><![cdata["chart displaying stacked bars"]]></subtitleexpression> </chartsubtitle> <chartlegend/> <hyperlinktooltipexpression><![cdata["stacked bar chart"]]></hyperlinktooltipexpression> </chart> <categorydataset> <dataset incrementtype="group" incrementgroup="salesstate"> <datasetrun subdataset="categorydataset"/> </dataset> <categoryseries> <seriesexpression><![cdata[$f{sales_state}]]></seriesexpression> <categoryexpression><![cdata[$f{full_name}]]></categoryexpression> <valueexpression><![cdata[$v{personamount}]]></valueexpression> </categoryseries> </categorydataset> <barplot> <plot/> <itemlabel/> <categoryaxislabelexpression><![cdata["name"]]></categoryaxislabelexpression> <valueaxislabelexpression><![cdata["amount"]]></valueaxislabelexpression> </barplot> </stackedbarchart> </band> </groupheader> </group>
Comments
Post a Comment