jasper reports - JasperReports: Group Data -
jasper reports - JasperReports: Group Data -
i using ireport 3.6.2 build reports. need build study displays total of each package. sql query returns below results.
**packname---------packcount** pack1 -------------- 4 pack2 -------------- 3 pack1 -------------- 1 pack3 -------------- 3 pack2 -------------- 3 pack1 -------------- 2
my study needs grouping packname , add together related packcount below example
**package name ------------ total** pack1 ---------------------- 7 pack2 ---------------------- 6 pack3 ---------------------- 3
i've got groupingcode below
<variable name="packscountsum" class="java.lang.integer" incrementtype="group" incrementgroup="packsgroup" calculation="sum"> <variableexpression><![cdata[$f{packcount}]]></variableexpression> </variable> <group name="packsgroup"> <groupexpression><![cdata[$f{packname}]]></groupexpression> <groupheader> <band height="20"> <textfield> <reportelement mode="opaque" x="0" y="5" width="515" height="15" backcolor="#c0c0c0"/> <textelement/> <textfieldexpression class="java.lang.string"><![cdata[$f{packname}]]></textfieldexpression> </textfield> <textfield> <reportelement x="460" y="1" width="30" height="15"/> <textelement textalignment="right"/> <textfieldexpression class="java.lang.integer"><![cdata[$v{packscountsum}]]></textfieldexpression> </textfield> </band> </groupheader> </group>
but results beingness displayed below
**package name ------------ total** pack2 ---------------------- null pack1 ---------------------- 3 pack2 ---------------------- 8 pack3 ---------------------- 10
could 1 please assist me , guide me in right direction. cannot seem find error is.
i seemed have solved issue. followed illustration on grouping records in jasperreports , helped me grouping. added "order by" in sql query ensure packnames ordered.
jasper-reports grouping
Comments
Post a Comment