问题描述:

I have two groups text fields.

1st group (Stock Code) is :

$F{VW_STOCKOPNAME_S1_KL}

$F{VW_STOCKOPNAME_S2_JB}

$F{VW_STOCKOPNAME_S3_NB}

$F{VW_STOCKOPNAME_S4_SB}

2nd group (Asset Code) is :

$F{VW_STOCKOPNAME_A1_GOLONGAN}

$F{VW_STOCKOPNAME_A2_BIDANG}

$F{VW_STOCKOPNAME_A3_KELOMPOK}

$F{VW_STOCKOPNAME_A4_SUBKELOMPOK}

$F{VW_STOCKOPNAME_A5_SUBSUBKEL}

and I have field called Product :

 $F{VW_STOCKOPNAME_PRODUCT}

Each product has either Asset Code / Stock Code.

If a product has Asset Code, then Stock Code field is automatically blank,

it works the other way around.

Code || Product

----------------------

1-2-1-1 || Stock Goods

0-2-3-1 || Asset Goods

How can I make it automatically show each product with matching code?

网友答案:

for all the textfields in group add property "Blank When Null"(isBlankWhenNull="true")

update: Added PrintWhenExpression

<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="143" y="29" width="260" height="20" isRemoveLineWhenBlank="true">
    <printWhenExpression><![CDATA[($F{VW_STOCKOPNAME_S1_KL}!=null && $F{VW_STOCKOPNAME_S2_JB}!=null && $F{VW_STOCKOPNAME_S3_NB}!=null && $F{VW_STOCKOPNAME_S4_SB}!=null)]]></printWhenExpression>
</reportElement>
<box leftPadding="2"/>
<textElement verticalAlignment="Middle">
    <font isBold="true"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{VW_STOCKOPNAME_S1_KL}]]></textFieldExpression>

or you can also use print when expression

相关阅读:
Top