drucken beim Ausdruck anzeigen Statischen text, wenn es mindestens einen nicht-null-Feld in einem detail-band

Ich möchte ein printWhenExpression auf einen statischen text basiert auf einer Bedingung, die sagt, dass das Etikett drucken nur, wenn es mindestens einen nicht-null-textField-Objekt in einer bestimmten Spalte in der detail-band.

Sein wie die print-überschrift der Spalte, nur, wenn es einen nicht-null-Feld in dieser Spalte.

Habe ich versucht, dass dieser Ausdruck: $F{textfield} != null, aber es funktioniert nur für den ersten Datensatz, wenn der erste Datensatz hat null und der zweite Eintrag hat nicht den Wert null, dann wird die Bezeichnung versteckt, wo wir Sie wollen angezeigt werden.

Bitte Antworten Sie, wenn Sie brauchen mehr info.

Die unten ist meine .jrxml-Datei.

<?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="IdpPdfSignature1" pageWidth="296" pageHeight="300" whenNoDataType="AllSectionsNoDetail" columnWidth="296" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="1c6e4be1-891b-4d0e-abfd-1c17f663d5be">
<property name="ireport.scriptlethandling" value="0"/>
<property name="ireport.encoding" value="UTF-8"/>
<import value="net.sf.jasperreports.engine.*"/>
<import value="java.util.*"/>
<import value="net.sf.jasperreports.engine.data.*"/>
<parameter name="mypic" class="java.io.InputStream" isForPrompting="false"/>
<parameter name="mypic1" class="java.io.InputStream" isForPrompting="false"/>
<parameter name="mypic2" class="java.io.InputStream" isForPrompting="false"/>
<parameter name="group" class="java.lang.String" isForPrompting="false"/>
<parameter name="device" class="java.lang.String" isForPrompting="false"/>
<parameter name="timeperiod" class="java.lang.String" isForPrompting="false"/>
<parameter name="customStartDate" class="java.util.Date" isForPrompting="false"/>
<parameter name="customEndDate" class="java.util.Date" isForPrompting="false"/>
<parameter name="footer" class="java.lang.String" isForPrompting="false"/>
<field name="signatureID" class="java.lang.String">
<fieldDescription><![CDATA[signatureID]]></fieldDescription>
</field>
<field name="signatureClassification" class="java.lang.String">
<fieldDescription><![CDATA[signatureClassification]]></fieldDescription>
</field>
<field name="description" class="java.lang.String">
<fieldDescription><![CDATA[description]]></fieldDescription>
</field>
<field name="count" class="java.lang.Long">
<fieldDescription><![CDATA[count]]></fieldDescription>
</field>
<field name="formattedCount" class="java.lang.String"/>
<field name="messageType" class="java.lang.String"/>
<variable name="mypic" class="java.io.InputStream"/>
<variable name="mypic1" class="java.io.InputStream"/>
<variable name="mypic2" class="java.io.InputStream"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band splitType="Stretch"/>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="16" splitType="Stretch">
<staticText>
<reportElement key="staticText-2" mode="Opaque" x="0" y="0" width="160" height="16" forecolor="#000000" backcolor="#CCCCCC" uuid="967c915b-1af1-4972-805f-0e3f365ba11c">
<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" size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Signature Name]]></text>
</staticText>
<staticText>
<reportElement key="staticText-3" mode="Opaque" x="210" y="0" width="86" height="16" forecolor="#000000" backcolor="#CCCCCC" uuid="a998a72e-01fa-4c27-ad7e-1e3a6c3408d2"/>
<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" size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Event Count]]></text>
</staticText>
<staticText>
<reportElement key="staticText-11" mode="Opaque" x="160" y="0" width="50" height="16" forecolor="#000000" backcolor="#CCCCCC" uuid="5170b4a6-3531-412d-9f8f-bc32dc4de0be">
<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" size="10" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[Type]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="16" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-7" stretchType="RelativeToTallestObject" x="160" y="0" width="50" height="16" uuid="917d3aff-44a7-4a26-865a-d466aff3ab00">
<printWhenExpression><![CDATA[new Boolean($F{messageType}!=null)]]></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>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField" stretchType="RelativeToTallestObject" x="0" y="0" width="160" height="16" uuid="72492119-a45f-49c5-8fb8-19252c57e402">
<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>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField" stretchType="RelativeToTallestObject" x="210" y="0" width="86" height="16" uuid="223be44f-8565-40e3-9d43-0f13b4e159b7"/>
<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>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
Schreibe einen Kommentar