Jasper reports 如果详细信息标注栏中至少有一个非空字段,则当表达式显示静态文本时打印
我想在静态文本上设置printWhenExpression,其条件是,仅当detail band中的特定列中至少有一个非空文本字段时,才打印标签 它类似于仅当列中有非空字段时才打印列标题 我试着用这个表达式:Jasper reports 如果详细信息标注栏中至少有一个非空字段,则当表达式显示静态文本时打印,jasper-reports,expression,Jasper Reports,Expression,我想在静态文本上设置printWhenExpression,其条件是,仅当detail band中的特定列中至少有一个非空文本字段时,才打印标签 它类似于仅当列中有非空字段时才打印列标题 我试着用这个表达式:$F{textfield}=null,但它仅适用于第一条记录,如果第一条记录为null,而第二条记录没有null值,则标签将隐藏在我们希望显示的位置 如果您需要更多信息,请回复 下面是我的.jrxml文件 通过在表的列标题的“Column print when”属性下提供print when
$F{textfield}=null
,但它仅适用于第一条记录,如果第一条记录为null,而第二条记录没有null值,则标签将隐藏在我们希望显示的位置
如果您需要更多信息,请回复
下面是我的.jrxml文件
通过在表的列标题的“Column print when”属性下提供print when条件,您可以使用Table Component来实现这一点,而不是使用静态文本 i、 e.列打印时间=$F{messageType}=空的 PFB更正的JRXML:
<summary>
<band height="55" splitType="Stretch">
<componentElement>
<reportElement uuid="632c8fad-e35f-4b89-b28e-b363b0711c06" x="0" y="0" width="270" height="55"/>
<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" uuid="bf16282a-8672-46cb-9849-4966b5f8c969">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
</datasetRun>
<jr:column width="90" uuid="00429e67-6d71-4b66-9eb4-22d0c649e7a4">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement uuid="a62a81ca-ceae-4178-9e4e-6ca17fc89c69" key="staticText-2" mode="Opaque" x="0" y="0" width="90" height="30" forecolor="#000000" backcolor="#CCCCCC">
<printWhenExpression><![CDATA[new Boolean($F{messageType}!=null)]]></printWhenExpression>
</reportElement>
<box>
<pen lineWidth="0.25" lineColor="#000000"/>
<topPen lineWidth="0.25" lineColor="#000000"/>
<leftPen lineWidth="0.25" lineColor="#000000"/>
<bottomPen lineWidth="0.25" lineColor="#000000"/>
<rightPen lineWidth="0.25" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Signature Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="cb654043-45a4-4742-86ed-ed9818716db2" key="textField" stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="20">
<printWhenExpression><![CDATA[new Boolean($F{messageType}!=null)]]></printWhenExpression>
</reportElement>
<box leftPadding="5" rightPadding="10">
<topPen lineWidth="0.25" lineColor="#999999"/>
<leftPen lineWidth="0.25" lineColor="#999999"/>
<bottomPen lineWidth="0.25" lineColor="#999999"/>
<rightPen lineWidth="0.25" lineColor="#999999"/>
</box>
<textElement>
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$F{signatureClassification}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="7ebf1fdd-52e5-43da-96f0-1c01a7cb0876">
<printWhenExpression><![CDATA[$F{messageType}!=null]]></printWhenExpression>
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement uuid="d96cce84-1318-49aa-a6d2-3a17e4329ef3" key="staticText-11" mode="Opaque" x="0" y="0" width="90" height="30" forecolor="#000000" backcolor="#CCCCCC">
<printWhenExpression><![CDATA[new Boolean($F{messageType}!=null)]]></printWhenExpression>
</reportElement>
<box>
<pen lineWidth="0.25" lineColor="#000000"/>
<topPen lineWidth="0.25" lineColor="#000000"/>
<leftPen lineWidth="0.25" lineColor="#000000"/>
<bottomPen lineWidth="0.25" lineColor="#000000"/>
<rightPen lineWidth="0.25" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Type]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="4832a90d-505e-4f13-87bf-0a7fe6e3a00f" key="textField-7" stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="20">
<printWhenExpression><![CDATA[$F{messageType}]]></printWhenExpression>
</reportElement>
<box leftPadding="5">
<topPen lineWidth="0.25" lineColor="#999999"/>
<leftPen lineWidth="0.25" lineColor="#999999"/>
<bottomPen lineWidth="0.25" lineColor="#999999"/>
<rightPen lineWidth="0.25" lineColor="#999999"/>
</box>
<textElement textAlignment="Left">
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$F{messageType}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="89b50640-0509-4b61-8aa3-aa68eb3e6685">
<jr:columnHeader height="30" rowSpan="1">
<staticText>
<reportElement uuid="fe68d8bf-3f0d-4202-a53c-8c6f328e4d16" key="staticText-3" mode="Opaque" x="0" y="0" width="90" height="30" forecolor="#000000" backcolor="#CCCCCC"/>
<box>
<pen lineWidth="0.25" lineColor="#000000"/>
<topPen lineWidth="0.25" lineColor="#000000"/>
<leftPen lineWidth="0.25" lineColor="#000000"/>
<bottomPen lineWidth="0.25" lineColor="#000000"/>
<rightPen lineWidth="0.25" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Event Count]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="20" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement uuid="169af53a-b587-4d63-93f8-cb9296c89f4c" key="textField" stretchType="RelativeToTallestObject" x="0" y="0" width="90" height="20"/>
<box leftPadding="5" rightPadding="10">
<topPen lineWidth="0.25" lineColor="#999999"/>
<leftPen lineWidth="0.25" lineColor="#999999"/>
<bottomPen lineWidth="0.25" lineColor="#999999"/>
<rightPen lineWidth="0.25" lineColor="#999999"/>
</box>
<textElement textAlignment="Right">
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[$F{formattedCount}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</summary>