i have set of records:
colors table.
color_group | color_name | color_no primary | red | 1 primary | blue | 3 primary | yellow | 2 secondary | green | 8 secondary | violet | 1 secondary | orange | 7 others | pink | 6 others | white | 4 others | black | 5
i want generate report this.
primary red 1 blue 3 yellow 2 secondary green 8 violet 1 orange 7 others pink 6 white 5 black 4
how can display in jasper report?
this solved using group on color_group
field , adding groupheader
band display value.
example
<?xml version="1.0" encoding="utf-8"?> <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="group" pagewidth="595" pageheight="842" columnwidth="555" leftmargin="20" rightmargin="20" topmargin="20" bottommargin="20" uuid="c1d9b4b7-6162-4b17-b871-3cf3b867d1ef"> <field name="color_group" class="java.lang.string"/> <field name="color_name" class="java.lang.string"/> <field name="color_no" class="java.lang.integer"/> <group name="colorgroup"> <groupexpression><![cdata[$f{color_group}]]></groupexpression> <groupheader> <band height="20"> <textfield> <reportelement x="0" y="0" width="100" height="20" uuid="e98d6fc1-1ecd-4af4-8250-d8aaa497011e"/> <textfieldexpression><![cdata[$f{color_group}]]></textfieldexpression> </textfield> </band> </groupheader> </group> <detail> <band height="20" splittype="stretch"> <textfield> <reportelement x="20" y="0" width="100" height="20" uuid="7ca1ac35-6249-4ba6-ac87-031f8d410d2e"/> <textfieldexpression><![cdata[$f{color_name}]]></textfieldexpression> </textfield> <textfield> <reportelement x="120" y="0" width="100" height="20" uuid="395b0cdd-4d2c-4d0b-93cd-7cad6daf3a4b"/> <textfieldexpression><![cdata[$f{color_no}]]></textfieldexpression> </textfield> </band> </detail> </jasperreport>
result
Comments
Post a Comment