Jump to content

Conditional ImageExpression help


vsoneta

Recommended Posts

Hello, I have to display the barcode only if my field from SQL is not null.. can you please help me how to achieve this.. my image tag in the jrmxl is :

So I need to check if $F(UPC1) != null then create a image otherwise keep a blank field for that row and column..

 

 

Code:
<image  scaleImage="FillFrame" vAlign="Middle" hAlign="Center" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >                    <reportElement                        mode="Opaque"                        x="374"                        y="0"                        width="76"                        height="28"                        forecolor="#000000"                        backcolor="#FFFFFF"                        key="barcode-1"/>                    <box></box>                    <graphicElement stretchType="NoStretch" fill="Solid" />                    <imageExpression class="java.awt.Image"><![CDATA[it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(5,$F{UPC1},true,false,$F{UPC1},0,0)]]></imageExpression>                </image>
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Got the solution: using <PrintWhenExpression> KEY WAS to new NEW Boolean...

 

<image  scaleImage="FillFrame" vAlign="Middle" hAlign="Center" evaluationTime="Now" hyperlinkType="None"  hyperlinkTarget="Self" >
                    <reportElement
                        mode="Transparent"
                        x="374"
                        y="2"
                        width="76"
                        height="28"
                        forecolor="#000000"
                        backcolor="#FFFFFF"
                        key="barcode-1">
                            <printWhenExpression><![CDATA[new Boolean($F{UPC1} != null )]]></printWhenExpression>
                        </reportElement>
                    <box></box>
                    <graphicElement stretchType="NoStretch" fill="Solid" />
                    <imageExpression class="java.awt.Image"><![CDATA[it.businesslogic.ireport.barcode.BcImage.getBarcodeImage(5,$F{UPC1},true,false,$F{UPC1},0,0)]]></imageExpression>
                </image>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...