我在使用crosstab运行报告时遇到问题。错误是:
错误填充打印...错误评估表达式:源文本:$V{cat_code} net.sf.jasperreports.engine.fill.JRExpressionEvalException:错误评估表达式:源文本:$V{cat_code}
我可以知道我的源代码有什么问题吗?这是我的代码:
<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="Corr_ticket" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoDataSection" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<?xml version="1.0" encoding="UTF-8"?>
<import value="com.google.common.base.*"/>
<style name="Crosstab Data Text" hAlign="Center"/>
<parameter name="daterangefrom" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="daterangeto" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="monthy" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="yrs" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="quarter" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="weeks" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
</queryString>
<field name="daterange" class="java.lang.String"/>
<field name="ticketid" class="java.lang.Integer"/>
<field name="cat_code" class="java.lang.Integer"/>
<field name="descategory" class="java.lang.String"/>
<field name="subcat_code1" class="java.lang.Integer"/>
<field name="dessub1cat" class="java.lang.String"/>
<field name="subcat_code2" class="java.lang.Integer"/>
<field name="dessub2cat" class="java.lang.String"/>
<field name="description_sub" class="java.lang.String"/>
<field name="description_source" class="java.lang.String"/>
<pageHeader>
<band height="141">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="53" width="802" height="35" isRemoveLineWhenBlank="true"/>
<textElement>
<font size="11" isBold="true"/>
<paragraph lineSpacing="1_1_2"/>
</textElement>
<textFieldExpression><![CDATA[(!Strings.isNullOrEmpty($P{daterangefrom}) && !Strings.isNullOrEmpty($P{daterangeto}) && Strings.isNullOrEmpty($P{weeks}) && Strings.isNullOrEmpty($P{monthy}) && Strings.isNullOrEmpty($P{quarter}) && Strings.isNullOrEmpty($P{yrs})) ? "Date Ticket Created From : " + $P{daterangefrom} +"\n" + "Date Ticket Created to : " + $P{daterangeto}
: null]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="0" y="119" width="100" height="20"/>
<textElement>
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[State :]]></text>
</staticText>
<staticText>
<reportElement x="0" y="98" width="90" height="20"/>
<textElement>
<font size="11" isBold="true"/>
</textElement>
<text><![CDATA[Industry Group :]]></text>
</staticText>
</band>
</pageHeader>
<summary>
<band height="297">
<crosstab>
<reportElement x="0" y="0" width="802" height="297"/>
<rowGroup name="ticketid" width="70" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{ticketid}]]></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><![CDATA[$V{ticketid}]]></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 ticketid]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="cat_code" height="30" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{cat_code}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField isBlankWhenNull="true">
<reportElement style="Crosstab Data Text" x="0" y="0" width="100" height="30"/>
<textElement/>
<textFieldExpression><![CDATA[$V{cat_code}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents backcolor="#005FB3" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<staticText>
<reportElement x="0" y="0" width="50" height="60" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Total cat_code]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<columnGroup name="description_source" height="30" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{description_source}]]></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><![CDATA[$V{description_source}]]></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 description_source]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="description_sourceMeasure" class="java.lang.Integer" calculation="Count">
<measureExpression><![CDATA[$F{description_source}]]></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><![CDATA[$V{description_sourceMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="25" rowTotalGroup="ticketid">
<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><![CDATA[$V{description_sourceMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="50" columnTotalGroup="cat_code">
<cellContents backcolor="#005FB3" 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" forecolor="#FFFFFF"/>
<textElement/>
<textFieldExpression><![CDATA[$V{description_sourceMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="ticketid" columnTotalGroup="cat_code">
<cellContents backcolor="#005FB3" 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" forecolor="#FFFFFF"/>
<textElement/>
<textFieldExpression><![CDATA[$V{description_sourceMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="50" columnTotalGroup="description_source">
<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><![CDATA[$V{description_sourceMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="ticketid" columnTotalGroup="description_source">
<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><![CDATA[$V{description_sourceMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</summary>
</jasperReport>
其他问题:-我认为问题是“表达式类”,因为我的字段有字段名称=“cat_code”类=“java.lang.Integer”并且我在交叉表中的变量有桶类=“java.lang.String”。如何处理这种情况?