sjlevine Posted October 19, 2009 Share Posted October 19, 2009 I have a text field with a yellow background and red font that I would like not to display when it is null. By not displaying, I mean that I don't want the yellow background to display:The XML for this field is attached:sjl Code:<textField> <reportElement mode="Opaque" x="148" y="14" width="507" height="24" forecolor="#F00000" backcolor="#F8F800"/> <textElement textAlignment="Center"> <font size="14"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{NODIFFMESS}]]></textFieldExpression> </textField> Link to comment Share on other sites More sharing options...
englbrechtful Posted October 20, 2009 Share Posted October 20, 2009 I guess by saying you dont want to display your text field when its null, you mean there should be _NO_ textfield in cases of null. Try this : $F{NODIFFMESS} == null ? : $F{NODIFFMESS} Link to comment Share on other sites More sharing options...
iancr01 Posted October 20, 2009 Share Posted October 20, 2009 You may also use the Print When Expression for your text field. Link to comment Share on other sites More sharing options...
sjlevine Posted October 20, 2009 Author Share Posted October 20, 2009 What would be the syntax of the Print When Expression when used for this purpose? It is not clear from the JasperReports Ultimate Guide. sjl Link to comment Share on other sites More sharing options...
mdahlman Posted October 20, 2009 Share Posted October 20, 2009 Your 'Print when' expression should be like this:new Boolean($F{NODIFFMESS} == null) Link to comment Share on other sites More sharing options...
VimMang Posted September 16, 2016 Share Posted September 16, 2016 Requirement: Text message should be display in Table like "No Data found" if data is not returned. How can I achieve this? Thanks in Advance. Link to comment Share on other sites More sharing options...
rprachi2 Posted January 10, 2018 Share Posted January 10, 2018 use coalesce or case like coalesce(field_name,'No Data found') or "case when field_name is null then 'No Data found' else field_name end" 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