CrossTab report

0
Hi all,

New to jasper report, planning to create cross tab report, can any one tell me how I can do that ?

Do we have any tutorial by which I can learn it step by step?
I already checked in documentation but there no much detail available.

Thanks,
Jenny
usstar99's picture
Joined: May 4 2008 - 11:36pm
Last seen: 5 years 11 months ago

5 Answers:

0
i am getting below error , please tell me what to do ?

ÂCompiling to file... C:\NYSI\test report\report1.jasper
net.sf.jasperreports.engine.design.JRValidationFault@4983d8ÂWarningÂ:ÂElementÂbottomÂreachesÂoutsideÂbandÂareaÂ:Ây=4Âheight=80Âband-height=79 Line:Â28,ÂColumn:Â14ÂJRXMLÂElement:Â/jasperReport/title[1]/band[1]/crosstab[1] net.sf.jasperreports.engine.design.JRValidationException:ÂReportÂdesignÂnotÂvalidÂ:Â ÂÂÂÂÂ1.ÂWarningÂ:ÂElementÂbottomÂreachesÂoutsideÂbandÂareaÂ:Ây=4Âheight=80Âband-height=79 ÂÂÂÂatÂnet.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:260) ÂÂÂÂatÂnet.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:144) ÂÂÂÂatÂcom.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:510) ÂÂÂÂatÂorg.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561) ÂÂÂÂatÂorg.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)
Compilation running time: 109
usstar99's picture
Joined: May 4 2008 - 11:36pm
Last seen: 5 years 11 months ago
0
I am using


Jasperreport 2.0.4

Product Version: iReport 0.9.1
Java: 1.5.0_06; Java HotSpot(TM) Client VM 1.5.0_06-b05
System: Windows XP version 5.1 running on x86; Cp1252; en_US (ireport)
usstar99's picture
Joined: May 4 2008 - 11:36pm
Last seen: 5 years 11 months ago
0
I know it’s only warning only but I am not able to see preview.

So I want to see it’s preview

Any help …
usstar99's picture
Joined: May 4 2008 - 11:36pm
Last seen: 5 years 11 months ago
0
Please see my XML code is



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD JasperReport//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport name="report name" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<style name="Crosstab Data Text" isDefault="false" hAlign="Center"/>
<queryString>
<![CDATA[ SELECT "sales_order"."cust_id",
"sales_order"."region",
"sales_order_items"."quantity"
FROM "sales_order",
"sales_order_items"
WHERE ( "sales_order_items"."id" = "sales_order"."id" ) ]]>
</queryString>
<field name="cust_id" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="region" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="quantity" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<background>
<band/>
</background>
<title>
<band>
<crosstab>
<reportElement x="0" y="15" width="555" height="400"/>
<rowGroup name="cust_id" width="70" totalPosition="End">
<bucket>
<bucketExpression class="java.lang.Integer"><![CDATA[$F{cust_id}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="25"/>
<textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{cust_id}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<staticText>
<reportElement x="0" y="0" width="70" height="25"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Total cust_id]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="region" height="30" totalPosition="End">
<bucket>
<bucketExpression class="java.lang.String"><![CDATA[$F{region}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="30"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$V{region}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<staticText>
<reportElement x="0" y="0" width="50" height="30"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Total region]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="quantityMeasure" class="java.lang.Integer" calculation="Count">
<measureExpression><![CDATA[$F{quantity}]]></measureExpression>
</measure>
<crosstabCell width="50" height="25">
<cellContents>
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{quantityMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="25" rowTotalGroup="cust_id">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{quantityMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="50" columnTotalGroup="region">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{quantityMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="cust_id" columnTotalGroup="region">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{quantityMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</title>
<pageHeader>
<band/>
</pageHeader>
<columnHeader>
<band/>
</columnHeader>
<detail>
<band height="400"/>
</detail>
<columnFooter>
<band height="15"/>
</columnFooter>
<pageFooter>
<band/>
</pageFooter>
<summary>
<band/>
</summary>
</jasperReport>
usstar99's picture
Joined: May 4 2008 - 11:36pm
Last seen: 5 years 11 months ago
0
you can see JASPERREPORTS FOR JAVA DEVELOPER.I learned much thing about creating crosstab report from it.Surely, the book is just for the junior.
ljz2008's picture
18
Joined: Feb 26 2008 - 10:44am
Last seen: 6 years 1 month ago
Feedback