2006 IR Open Dicussion Posted August 26, 2006 Share Posted August 26, 2006 By: gouwa - gouwa crosstab problem with Hibernate 2006-01-16 23:35 How can I describe a subdataset in a crosstab report when I put the data to the detail band with Hibernate data? I succeed in putting the data to the summary band because I have not use the subdataset. This is my summary band .jrxml: (describe dataset which used in the crosstab): <field name="devCatalogNo" class="java.lang.String"/> <field name="devTypeNo" class="java.lang.String"/> <field name="devNo" class="java.lang.String"/> <field name="devName" class="java.lang.String"/> <field name="catalog" class="java.lang.String"/> <field name="dayTimes" class="java.lang.Integer"/> and define a crosstabdataset in the crosstab: <crosstabDataset isDataPreSorted="true"> <dataset></dataset> </crosstabDataset> How can I do to show the data in a detail band??? Thanks! gouwa By: Lucian Chirita - lucianc RE: crosstab problem with Hibernate 2006-01-17 01:10 I'm not sure I understood your question.. If you have in the detail band data in a Hibernate collection that you'd want to feed to a crosstab, you should use a sub dataset run and set its dataSourceExpression to new JRBeanCollectionDataSource(<your collection>). Check out this thread also https://sourceforge.net/forum/forum.php?thread_id=1419914&forum_id=113530 Regards, Lucian By: gouwa - gouwa RE: crosstab problem with Hibernate 2006-01-17 04:49 hi,it's my .jrxml file: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="w_caseinfo_table1" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="812" leftMargin="15" rightMargin="15" topMargin="10" bottomMargin="10"> <reportFont name="SongTi" isDefault="false" fontName="æ°“åºè¥ç›²é™†è¯" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="STSong-Light" pdfEncoding="UniGB-UCS2-H" isPdfEmbedded="true"/> <style name="Arial_Normal" isDefault="true" fontName="Arial" fontSize="8" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <style name="Arial_Bold" isDefault="false" fontName="Arial" fontSize="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <parameter name="title" class="java.lang.String"/> <parameter name="statdate" class="java.lang.String"/> <parameter name="enddate" class="java.lang.String"/> <field name="devCatalogNo" class="java.lang.String"/> <field name="devTypeNo" class="java.lang.String"/> <field name="devNo" class="java.lang.String"/> <field name="devName" class="java.lang.String"/> <field name="catalog" class="java.lang.String"/> <field name="dayTimes" class="java.lang.Integer"/> <summary> <band height="160"> <crosstab name="w_caseinfo_table1" isRepeatColumnHeaders="false"> <reportElement x="0" y="60" width="812" height="60" mode="Opaque"/> <crosstabDataset isDataPreSorted="true"> <dataset> </dataset> </crosstabDataset> <rowGroup name="devcatalog" width="20" totalPosition="End"> <bucket> <bucketExpression class="java.lang.String">$F{devCatalogNo}</bucketExpression> </bucket> <crosstabRowHeader> <cellContents> <box leftBorder="2Point" bottomBorder="2Point" rightBorder="2Point"/> <textField> <reportElement x="5" y="5" width="10" height="20"/> <textFieldExpression>$V{devcatalog}</textFieldExpression> </textField> </cellContents> </crosstabRowHeader> <crosstabTotalRowHeader> <cellContents backcolor="#60FFFF"> <box leftBorder="2Point" bottomBorder="2Point" rightBorder="2Point"/> <textField> <reportElement x="5" y="5" width="150" height="20"/> <textFieldExpression>" devcata Total"</textFieldExpression> </textField> </cellContents> </crosstabTotalRowHeader> </rowGroup> <rowGroup name="devtypeno" width="20" totalPosition="End"> <bucket> <bucketExpression class="java.lang.String">$F{devTypeNo}</bucketExpression> </bucket> <crosstabRowHeader> <cellContents> <box bottomBorder="2Point" rightBorder="2Point"/> <textField> <reportElement x="5" y="5" width="10" height="20"/> <textFieldExpression>$V{devtypeno}</textFieldExpression> </textField> </cellContents> </crosstabRowHeader> <crosstabTotalRowHeader> <cellContents backcolor="#60FFFF"> <box bottomBorder="2Point" rightBorder="2Point"/> <textField> <reportElement x="5" y="5" width="150" height="20"/> <textFieldExpression>" devtype Total"</textFieldExpression> </textField> </cellContents> </crosstabTotalRowHeader> </rowGroup> <rowGroup name="devno" width="100" totalPosition="End"> <bucket> <bucketExpression class="java.lang.String">$F{devNo}</bucketExpression> </bucket> <crosstabRowHeader> <cellContents> <box bottomBorder="2Point" rightBorder="2Point"/> <textField> <reportElement x="5" y="5" width="90" height="20"/> <textFieldExpression>$V{devno}</textFieldExpression> </textField> </cellContents> </crosstabRowHeader> <crosstabTotalRowHeader> <cellContents backcolor="#60FFFF"> <box bottomBorder="2Point" rightBorder="2Point"/> <textField> <reportElement x="5" y="5" width="150" height="20"/> <textFieldExpression>" devno Total"</textFieldExpression> </textField> </cellContents> </crosstabTotalRowHeader> </rowGroup> <rowGroup name="devname" width="100" > <bucket> <bucketExpression class="java.lang.String">$F{devName}</bucketExpression> </bucket> <crosstabRowHeader> <cellContents> <box bottomBorder="2Point" rightBorder="2Point"/> <textField> <reportElement x="5" y="5" width="90" height="20"/> <textFieldExpression>$V{devname}</textFieldExpression> </textField> </cellContents> </crosstabRowHeader> </rowGroup> <columnGroup name="faultCatalog" height="50" totalPosition="End" headerPosition="Stretch"> <bucket> <bucketExpression class="java.lang.String">$F{catalog}</bucketExpression> </bucket> <crosstabColumnHeader> <cellContents > <box topBorder="2Point" bottomBorder="2Point" rightBorder="2Point"/> <textField> <reportElement x="5" y="5" width="90" height="40"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font isBold="true"/> </textElement> <textFieldExpression class="java.lang.String">$V{faultCatalog}</textFieldExpression> </textField> </cellContents> </crosstabColumnHeader> <crosstabTotalColumnHeader> <cellContents backcolor="#E0FFFF"> <box topBorder="2Point" bottomBorder="2Point" rightBorder="2Point"/> <staticText> <reportElement x="5" y="5" width="80" height="40"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font isBold="true"/> </textElement> <text>Total</text> </staticText> </cellContents> </crosstabTotalColumnHeader> </columnGroup> <measure name="times" class="java.lang.Integer" calculation="Sum"> <measureExpression>$F{dayTimes}</measureExpression> </measure> <crosstabCell width="100" height="30"> <cellContents backcolor="#FFFFFF"> <box bottomBorder="1Point" rightBorder="1Point"/> <textField> <reportElement x="5" y="5" width="90" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression class="java.lang.Integer">$V{times}</textFieldExpression> </textField> </cellContents> </crosstabCell> <crosstabCell width="100" height="30" rowTotalGroup="devcatalog"> <cellContents backcolor="yellow"> <box borderColor="black" bottomBorder="1Point" rightBorder="1Point"/> <textField> <reportElement x="5" y="5" width="90" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression class="java.lang.Integer">$V{times}</textFieldExpression> </textField> </cellContents> </crosstabCell> <crosstabCell width="100" height="30" rowTotalGroup="devtypeno"> <cellContents backcolor="yellow"> <box borderColor="black" bottomBorder="1Point" rightBorder="1Point"/> <textField> <reportElement x="5" y="5" width="90" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression class="java.lang.Integer">$V{times}</textFieldExpression> </textField> </cellContents> </crosstabCell> <crosstabCell width="100" height="30" rowTotalGroup="devno"> <cellContents backcolor="yellow"> <box borderColor="black" bottomBorder="1Point" rightBorder="1Point"/> <textField> <reportElement x="5" y="5" width="90" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression class="java.lang.Integer">$V{times}</textFieldExpression> </textField> </cellContents> </crosstabCell> <crosstabCell width="100" height="30" columnTotalGroup="faultCatalog"> <cellContents backcolor="yellow"> <box borderColor="black" bottomBorder="1Point" rightBorder="1Point"/> <textField> <reportElement x="5" y="5" width="90" height="20"/> <textElement textAlignment="Center" verticalAlignment="Middle"/> <textFieldExpression class="java.lang.Integer">$V{times}</textFieldExpression> </textField> </cellContents> </crosstabCell> </crosstab> </band> </summary> </jasperReport> and I generate the JasperPrint file in the following Java language: JRBeanCollectionDataSource dstable1= new JRBeanCollectionDataSource(temptable1); String pathxml = request.getSession().getServletContext().getRealPath(jrxmltable1); jaspertable1 = (JasperReport)JasperCompileManager.compileReport(pathxml); JasperPrint jasperPrinttable1 = JasperFillManager.fillReport(jaspertable1, parameters, dstable1); so i only use field name in the .jrxml file. i am confused in if i only use JavaBean's fields to feed the dataset in the detail band. By: Lucian Chirita - lucianc RE: crosstab problem with Hibernate 2006-01-17 06:58 Now I'm sure I didn't understand your question. What are trying to achieve and what is wrong with the JRXML you posted? Regards, Lucian 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