ページ ヘッダー バンドに配置したテキスト フィールドを非表示にしようとしています。フィールド値は、実行時にレポートに渡されるいくつかのパラメーターによって決定されます。基本的に、パラメーター値が null (または一部が null) の場合、フィールドを空白または非表示にする必要があります。
コードを実行すると、incompatable operand int and integer
. 以下にレポートを添付しました。
<?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="Date_Register"
columnCount="1"
printOrder="Vertical"
orientation="Landscape"
pageWidth="842"
pageHeight="595"
columnWidth="802"
columnSpacing="0"
leftMargin="20"
rightMargin="20"
topMargin="20"
bottomMargin="20"
whenNoDataType="AllSectionsNoDetail"
isTitleNewPage="false"
isSummaryNewPage="false">
<property name="ireport.zoom" value="1.0" />
<property name="ireport.x" value="95" />
<property name="ireport.y" value="3" />
<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="date_start" isForPrompting="true" class="java.sql.Timestamp">
<defaultValueExpression ><![CDATA[new java.sql.Timestamp(0)]]></defaultValueExpression>
</parameter>
<parameter name="date_end" isForPrompting="true" class="java.sql.Timestamp">
<defaultValueExpression ><![CDATA[new java.sql.Timestamp(System.currentTimeMillis())]]></defaultValueExpression>
</parameter>
<parameter name="lookup_month" isForPrompting="true" class="java.lang.Integer">
<defaultValueExpression ><![CDATA[new Integer(-1)]]></defaultValueExpression>
</parameter>
<parameter name="lookup_year" isForPrompting="true" class="java.lang.Integer">
<defaultValueExpression ><![CDATA[new Integer(-1)]]></defaultValueExpression>
</parameter>
<parameter name="lookup_quarter" isForPrompting="true" class="java.lang.Integer">
<defaultValueExpression ><![CDATA[new Integer(-1)]]></defaultValueExpression>
</parameter>
<parameter name="lookup_weeks" isForPrompting="true" class="java.lang.Integer">
<defaultValueExpression ><![CDATA[new Integer(-1)]]></defaultValueExpression>
</parameter>
<parameter name="woman_status" isForPrompting="true" class="java.lang.String">
<defaultValueExpression ><![CDATA["N"]]></defaultValueExpression>
</parameter>
<parameter name="industry_group" isForPrompting="true" class="java.lang.Integer">
<defaultValueExpression ><![CDATA[new Integer(-1)]]></defaultValueExpression>
</parameter>
<parameter name="equity_structure" isForPrompting="true" class="java.lang.String">
<defaultValueExpression ><![CDATA["BUMIPUTERA"]]></defaultValueExpression>
</parameter>
<queryString><![CDATA[select distinct convert(varchar(10),a.entered,103) as daterange,
a.org_id,
a.name,
a.business_name_two,
a.organization_type,
c.description as companygroup,lead,
a.industry_temp_code,
b.description,
a.equity_structure,
case when a.sic_description = 1 then 'BUMIPUTERA'
when a.sic_description = 2 then 'NON BUMIPUTERA' end race,
convert(varchar(10),a.entered,103) as
dateregister
from organization a
left join lookup_industry b on a.industry_temp_code = b.code
left join lookup_company_group c on c.code = a.company_group
left join ticket d on d.org_id = a.org_id
left join lookup_month lm on lm.code =a.operation_date
left join lookup_weeks lw on lw.code =a.operation_date
left join lookup_quarter lq on lq.code =a.operation_date
left join lookup_year ly on ly.code =a.operation_date
where
a.equity_structure is not null
and
business_name_two is not null
and
c.description is not null
and
((a.business_name_two = $P{woman_status}) or ($P{woman_status} = ' '))
and
((a.industry_temp_code = $P{industry_group}) or($P{industry_group} = -1))
and
(((case when a.sic_description = 1 then 'BUMIPUTERA'
when a.sic_description = 2 then 'NON BUMIPUTERA' end ) = $P{equity_structure}) or ($P{equity_structure} = ' '))
and
((a.operation_date BETWEEN convert(datetime,$P{date_start},103) AND convert(datetime,$P{date_end},103))
or (convert(datetime,$P{date_start},103) =' ' AND convert(datetime,$P{date_end},103) = ' '))
AND
((lm.code = $P{lookup_month}) or ($P{lookup_month} = -1))
AND
((ly.code = $P{lookup_year}) or ($P{lookup_year} = -1))
AND
((lq.code = $P{lookup_quarter}) or ($P{lookup_quarter} = -1))
AND
((lw.code = $P{lookup_weeks}) or ($P{lookup_weeks} = -1))]]></queryString>
<field name="daterange" class="java.lang.String"/>
<field name="org_id" class="java.lang.Integer"/>
<field name="name" class="java.lang.String"/>
<field name="business_name_two" class="java.lang.String"/>
<field name="organization_type" class="java.lang.String"/>
<field name="companygroup" class="java.lang.String"/>
<field name="lead" class="java.lang.String"/>
<field name="industry_temp_code" class="java.lang.Integer"/>
<field name="description" class="java.lang.String"/>
<field name="equity_structure" class="java.lang.String"/>
<field name="race" class="java.lang.String"/>
<field name="dateregister" class="java.lang.String"/>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="0" isSplitAllowed="true" >
</band>
</title>
<pageHeader>
<band height="187" isSplitAllowed="true" >
<staticText>
<reportElement
x="0"
y="0"
width="802"
height="18"
key="staticText"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Center">
<font fontName="SansSerif" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Date Registered
]]></text>
</staticText>
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="0"
y="54"
width="802"
height="42"
key="textField-1"
isRemoveLineWhenBlank="true"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Left" verticalAlignment="Top" rotation="None" isStyledText="true" lineSpacing="1_1_2">
<font size="11" isBold="true"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[($P{date_start}!= null) && ($P{date_end}!=null) && ($P{lookup_month}!= -1) && ($P{lookup_year}!=-1)&& ($P{lookup_quarter}!= -1) && ($P{lookup_weeks}!=-1) ? "Date Ticket Created From : " + new SimpleDateFormat("dd/MM/yyyy").format($P{date_start}) +"\n" + "Date Ticket Created to : " + new SimpleDateFormat("dd/MM/yyyy").format($P{date_end})
: null]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="0"
y="20"
width="802"
height="35"
key="textField-2"
isRemoveLineWhenBlank="true"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement textAlignment="Center" verticalAlignment="Top" rotation="None" lineSpacing="Single">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[($P{date_start}!= null) && ($P{date_end}!=null) && ($P{lookup_month}== -1) && ($P{lookup_year}==-1)&& ($P{lookup_quarter}== -1) && ($P{lookup_weeks}==-1)? " From ( " + new SimpleDateFormat("dd/MM/yyyy").format($P{date_start}) + " - " + new SimpleDateFormat("dd/MM/yyyy").format($P{date_end}) + " )"
:($P{date_start}== null) && ($P{date_end}==null) && ($P{lookup_month}!= -1) && ($P{lookup_year}!=-1)&& ($P{lookup_quarter}== -1) && ($P{lookup_weeks}!=-1)? "For week " + $P{lookup_weeks} +" "+ $P{lookup_month} +" "+ $P{lookup_year}
:($P{date_start}== null) && ($P{date_end}==null) && ($P{lookup_month}!= -1) && ($P{lookup_year}!=-1)&& ($P{lookup_quarter}== -1) && ($P{lookup_weeks}==-1)? "For monthly " +$P{lookup_month} +" "+ $P{lookup_year}
:($P{date_start}== null) && ($P{date_end}==null) && ($P{lookup_month}== -1) && ($P{lookup_year}!=-1)&& ($P{lookup_quarter}!= -1) && ($P{lookup_weeks}==-1)? "For Quarter " + $P{lookup_quarter} +" "+$P{lookup_year}
:($P{date_start}== null) && ($P{date_end}==null) && ($P{lookup_month}== -1) && ($P{lookup_year}!=-1)&& ($P{lookup_quarter}== -1) && ($P{lookup_weeks}==-1)? "For Year " + $P{lookup_year}
: $P{lookup_year}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="0" isSplitAllowed="true" >
</band>
</columnHeader>
<detail>
<band height="0" isSplitAllowed="true" >
</band>
</detail>
<columnFooter>
<band height="0" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="0" isSplitAllowed="true" >
</band>
</pageFooter>
<summary>
<band height="0" isSplitAllowed="true" >
</band>
</summary>
</jasperReport>