Print when expression with collectionToCommaDelimitedString

Hello,

I’m using iReport 5.6.0 and I have two Text Fields. The first is listing my observers comma-separated.

 

<textField isStretchWithOverflow="true" isBlankWhenNull="true">

<reportElement mode="Transparent" x="239" y="155" width="244" height="15" uuid="7704e09f-2c07-4449-a326-72d05ab2964c"/>

<box leftPadding="5">

<leftPen lineWidth="1.0" lineColor="#FF6600"/>

</box>

<textElement verticalAlignment="Middle"/>

<textFieldExpression><![CDATA[de.hlsolutions.taskworker.util.JsonUtils.collectionToCommaDelimitedString($F{observer}, ".user.display")]]></textFieldExpression>

</textField>

 

The second one should show “no observers”, if there is no observer.

 

<textField>

<reportElement x="239" y="155" width="244" height="15" uuid="f14b17fb-f479-44d4-8ef3-9f4ad16b1798">

<printWhenExpression><![CDATA[$F{observer}.equals( null )]]></printWhenExpression>

</reportElement>

<box leftPadding="5">

<leftPen lineWidth="1.0" lineColor="#FF6600"/>

</box>

<textElement verticalAlignment="Middle">

<font isItalic="true"/>

</textElement>

<textFieldExpression><![CDATA[$R{task.filter.noObserver}]]></textFieldExpression>

</textField>

 

I tried to achieve this with a Print when expression $F{observer}.equals( null ) but it’s not working because the other text field is never gone be null.

I hope this will work with another Print when expression.

Tank you :)

tim.westhoff's picture
Joined: Apr 18 2016 - 5:56am
Last seen: 1 year 3 months ago

1 Answer:

Print When Expression: $F{supporters}.isMissingNode()

Thats it :)

tim.westhoff's picture
Joined: Apr 18 2016 - 5:56am
Last seen: 1 year 3 months ago
Feedback