mytval Posted August 24, 2011 Share Posted August 24, 2011 Hi, I'm trying to display a crosstable (detail or summary band) but when trying to access the "Preview" section, I get the message "The document has no page" and I couldn't see any results.My table in the database aren't empty so I don't get what's going on!!! Could someone help me with crosstable?Cheers Link to comment Share on other sites More sharing options...
mytval Posted August 24, 2011 Author Share Posted August 24, 2011 Here is my XML fileCode:<?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="xqueries-stats" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="77"/> <style name="Crosstab Data Text" hAlign="Center"/> <subDataset name="mydataset"> <queryString language="SQL"> <![CDATA[select * from mytable]]> </queryString> <field name="id" class="java.lang.Long"/> <field name="callhost" class="java.lang.String"/> <field name="department" class="java.lang.String"/> <field name="time" class="java.sql.Timestamp"/> </subDataset> <background> <band splitType="Stretch"/> </background> <title> <band height="79" splitType="Stretch"/> </title> <pageHeader> <band height="35" splitType="Stretch"/> </pageHeader> <columnHeader> <band height="61" splitType="Stretch"/> </columnHeader> <detail> <band height="125" splitType="Stretch"/> </detail> <columnFooter> <band height="45" splitType="Stretch"/> </columnFooter> <pageFooter> <band height="54" splitType="Stretch"/> </pageFooter> <summary> <band height="125" splitType="Stretch"> <crosstab> <reportElement x="0" y="0" width="555" height="125"/> <crosstabDataset> <dataset> <datasetRun subDataset="mydataset"> <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression> </datasetRun> </dataset> </crosstabDataset> <rowGroup name="callhost" width="70" totalPosition="End"> <bucket class="java.lang.String"> <bucketExpression><![CDATA[$F{callhost}]]></bucketExpression> </bucket> <crosstabRowHeader> <cellContents backcolor="#FF6347" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="70" height="25"/> <textElement/> <textFieldExpression><![CDATA[$V{callhost}]]></textFieldExpression> </textField> </cellContents> </crosstabRowHeader> <crosstabTotalRowHeader> <cellContents backcolor="#FFC9BF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/> </box> <staticText> <reportElement x="0" y="0" width="70" height="25"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <text><![CDATA[Total callhost]]></text> </staticText> </cellContents> </crosstabTotalRowHeader> </rowGroup> <columnGroup name="department" height="30" totalPosition="End"> <bucket class="java.lang.String"> <bucketExpression><![CDATA[$F{department}]]></bucketExpression> </bucket> <crosstabColumnHeader> <cellContents backcolor="#FF6347" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="30"/> <textElement/> <textFieldExpression><![CDATA[$V{department}]]></textFieldExpression> </textField> </cellContents> </crosstabColumnHeader> <crosstabTotalColumnHeader> <cellContents backcolor="#FFC9BF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/> </box> <staticText> <reportElement x="0" y="0" width="50" height="30"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <text><![CDATA[Total department]]></text> </staticText> </cellContents> </crosstabTotalColumnHeader> </columnGroup> <measure name="timeMeasure" class="java.lang.Integer" calculation="Count"> <measureExpression><![CDATA[$F{time}]]></measureExpression> </measure> <crosstabCell width="50" height="25"> <cellContents> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/> <textElement/> <textFieldExpression><![CDATA[$V{timeMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> <crosstabCell height="25" rowTotalGroup="callhost"> <cellContents backcolor="#FFC9BF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/> <textElement/> <textFieldExpression><![CDATA[$V{timeMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> <crosstabCell width="50" height="25" columnTotalGroup="department"> <cellContents backcolor="#FFC9BF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/> <textElement/> <textFieldExpression><![CDATA[$V{timeMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> <crosstabCell height="25" rowTotalGroup="callhost" columnTotalGroup="department"> <cellContents backcolor="#FFC9BF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#FFFFFF"/> </box> <textField> <reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/> <textElement/> <textFieldExpression><![CDATA[$V{timeMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> </crosstab> </band> </summary></jasperReport> Link to comment Share on other sites More sharing options...
mytval Posted August 24, 2011 Author Share Posted August 24, 2011 And mytable looks like that:id | callhost | department | time1 | paris | commercial | 2010-02-10 04:20:152 | orleans | client support | 2010-02-10 01:30:103 | nice | sales&support | 2010-02-10 03:60:15 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now