Jump to content
Changes to the Jaspersoft community edition download ×

Table can't show data for javabean data source


demohawk

Recommended Posts

4.0.2 version,If I don't use Table,javabean data can show,but I create a table,it show null.I don't know why?

Code:
<?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="CarrierNoteDetail" language="groovy" pageWidth="612" pageHeight="792" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">	<property name="ireport.zoom" value="1.5"/>	<property name="ireport.x" value="0"/>	<property name="ireport.y" value="0"/>	<style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>	<style name="Detail" fontName="Arial" fontSize="12"/>	<style name="table">		<box>			<pen lineWidth="1.0" lineColor="#000000"/>		</box>	</style>	<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<style name="table 1">		<box>			<pen lineWidth="1.0" lineColor="#000000"/>		</box>	</style>	<style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>		<conditionalStyle>			<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>			<style backcolor="#EFF7FF"/>		</conditionalStyle>	</style>	<style name="table 2">		<box>			<pen lineWidth="1.0" lineColor="#000000"/>		</box>	</style>	<style name="table 2_TH" mode="Opaque" backcolor="#F0F8FF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<style name="table 2_CH" mode="Opaque" backcolor="#BFE1FF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<style name="table 2_TD" mode="Opaque" backcolor="#FFFFFF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<style name="table 3">		<box>			<pen lineWidth="1.0" lineColor="#000000"/>		</box>	</style>	<style name="table 3_TH" mode="Opaque" backcolor="#F0F8FF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<style name="table 3_CH" mode="Opaque" backcolor="#BFE1FF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<style name="table 3_TD" mode="Opaque" backcolor="#FFFFFF">		<box>			<pen lineWidth="0.5" lineColor="#000000"/>		</box>	</style>	<subDataset name="Table Dataset 1" whenResourceMissingType="Empty">		<field name="code" class="java.lang.String">			<fieldDescription><![CDATA[code]]></fieldDescription>		</field>		<field name="name" class="java.lang.String">			<fieldDescription><![CDATA[name]]></fieldDescription>		</field>		<field name="applyAmount" class="java.lang.Double">			<fieldDescription><![CDATA[applyAmount]]></fieldDescription>		</field>		<field name="wpCode" class="java.lang.String">			<fieldDescription><![CDATA[wpCode]]></fieldDescription>		</field>	</subDataset>	<queryString>		<![CDATA[]]>	</queryString>	<background>		<band splitType="Stretch"/>	</background>	<title>		<band splitType="Stretch"/>	</title>	<detail>		<band height="51" splitType="Stretch">			<componentElement>				<reportElement key="table 3" style="table 3" x="0" y="0" width="572" height="50"/>				<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">					<datasetRun subDataset="Table Dataset 1">						<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>					</datasetRun>					<jr:column width="90">						<jr:columnHeader style="table 3_CH" height="30">							<staticText>								<reportElement x="0" y="0" width="90" height="30"/>								<textElement>									<font pdfFontName="STSong-Light" pdfEncoding="UniCNS-UCS2-H" isPdfEmbedded="true"/>								</textElement>								<text><![CDATA[Code]]></text>							</staticText>						</jr:columnHeader>						<jr:detailCell style="table 3_TD" height="20">							<textField>								<reportElement x="0" y="0" width="90" height="20"/>								<textElement>									<font pdfFontName="STSong-Light" pdfEncoding="UniCNS-UCS2-H" isPdfEmbedded="true"/>								</textElement>								<textFieldExpression class="java.lang.String"><![CDATA[$F{code}]]></textFieldExpression>							</textField>						</jr:detailCell>					</jr:column>					<jr:column width="90">						<jr:columnHeader style="table 3_CH" height="30">							<staticText>								<reportElement x="0" y="0" width="90" height="30"/>								<textElement>									<font pdfFontName="STSong-Light" pdfEncoding="UniCNS-UCS2-H" isPdfEmbedded="true"/>								</textElement>								<text><![CDATA[Name]]></text>							</staticText>						</jr:columnHeader>						<jr:detailCell style="table 3_TD" height="20">							<textField>								<reportElement x="0" y="0" width="90" height="20"/>								<textElement>									<font pdfFontName="STSong-Light" pdfEncoding="UniCNS-UCS2-H" isPdfEmbedded="true"/>								</textElement>								<textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>							</textField>						</jr:detailCell>					</jr:column>					<jr:column width="90">						<jr:columnHeader style="table 3_CH" height="30">							<staticText>								<reportElement x="0" y="0" width="90" height="30"/>								<textElement>									<font pdfFontName="STSong-Light" pdfEncoding="UniCNS-UCS2-H" isPdfEmbedded="true"/>								</textElement>								<text><![CDATA[Amount]]></text>							</staticText>						</jr:columnHeader>						<jr:detailCell style="table 3_TD" height="20">							<textField>								<reportElement x="0" y="0" width="90" height="20"/>								<textElement>									<font pdfFontName="STSong-Light" pdfEncoding="UniCNS-UCS2-H" isPdfEmbedded="true"/>								</textElement>								<textFieldExpression class="java.lang.Double"><![CDATA[$F{applyAmount}]]></textFieldExpression>							</textField>						</jr:detailCell>					</jr:column>					<jr:column width="90">						<jr:columnHeader style="table 3_CH" height="30">							<staticText>								<reportElement x="0" y="0" width="90" height="30"/>								<textElement>									<font pdfFontName="STSong-Light" pdfEncoding="UniCNS-UCS2-H" isPdfEmbedded="true"/>								</textElement>								<text><![CDATA[WorkPackage]]></text>							</staticText>						</jr:columnHeader>						<jr:detailCell style="table 3_TD" height="20">							<textField>								<reportElement x="0" y="0" width="90" height="20"/>								<textElement>									<font pdfFontName="STSong-Light" pdfEncoding="UniCNS-UCS2-H" isPdfEmbedded="true"/>								</textElement>								<textFieldExpression class="java.lang.String"><![CDATA[$F{wpCode}]]></textFieldExpression>							</textField>						</jr:detailCell>					</jr:column>				</jr:table>			</componentElement>		</band>	</detail></jasperReport>
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

is it "datasetRun" wrong?who can help me.

Code:
<datasetRun subDataset="Table Dataset 1"><dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression></datasetRun>
Link to comment
Share on other sites

  • 2 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...