如何将JasperReports 4.x语法中的 if-else 表达式迁移到JasperReports 2.x语法?
这是我的代码:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
name="convertString"
columnCount="1"
printOrder="Vertical"
orientation="Portrait"
pageWidth="595"
pageHeight="842"
columnWidth="555"
columnSpacing="0"
leftMargin="20"
rightMargin="20"
topMargin="20"
bottomMargin="20"
whenNoDataType="NoPages"
isTitleNewPage="false"
isSummaryNewPage="false">
<property name="ireport.zoom" value="1.0" />
<property name="ireport.x" value="0" />
<property name="ireport.y" value="6" />
<property name="ireport.scriptlethandling" value="0" />
<property name="ireport.encoding" value="UTF-8" />
<import value="java.util.*" />
<import value="net.sf.jasperreports.engine.*" />
<import value="net.sf.jasperreports.engine.data.*" />
<import value="com.google.common.base.*" />
<parameter name="pd_id" isForPrompting="true" class="java.lang.Integer"/>
<parameter name="acl" isForPrompting="true" class="java.lang.String"/>
<queryString><![CDATA[select * from WF_PROC_DEF,acl_module
where pd_id=$P{pd_id}
and acl_module_id = $P{acl}]]></queryString>
<field name="PD_ID" class="java.math.BigDecimal"/>
<field name="PD_NAME" class="java.lang.String"/>
<field name="OLD_PD_ID" class="java.lang.String"/>
<field name="ACL_MODULE_ID" class="java.lang.String"/>
<field name="ACL_MODULE_DESC" class="java.lang.String"/>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="79" isSplitAllowed="true" >
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="17"
y="18"
width="100"
height="20"
key="textField"
isRemoveLineWhenBlank="true"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$P{pd_id}==1 ? "External Agencies" :
$P{pd_id}==2 ? "Planning, Building & Land" :
$P{pd_id}==3 ? "Composit Forms" :$P{pd_id}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="0" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="20" isSplitAllowed="true" >
<staticText>
<reportElement
x="0"
y="0"
width="277"
height="20"
key="staticText"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font/>
</textElement>
<text><![CDATA[PD_ID]]></text>
</staticText>
<staticText>
<reportElement
x="277"
y="0"
width="277"
height="20"
key="staticText"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font/>
</textElement>
<text><![CDATA[PD_NAME]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" isSplitAllowed="true" >
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="0"
y="0"
width="277"
height="20"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{PD_ID}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="277"
y="0"
width="277"
height="20"
key="textField"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{PD_NAME}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="54" isSplitAllowed="true" >
</band>
</pageFooter>
<summary>
<band height="42" isSplitAllowed="true" >
</band>
</summary>
</jasperReport>
另一个问题:
您是否有关于 iReport 2.0.2 的一些简短示例或教程?