vsoneta Posted June 29, 2009 Share Posted June 29, 2009 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 More sharing options...
vsoneta Posted June 29, 2009 Author Share Posted June 29, 2009 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 More sharing options...
Giulio Toffoli Posted June 29, 2009 Share Posted June 29, 2009 I always suggest to use groovy as report language. In that case $F(UPC1) != null was enough.Giulio Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now