Jump to content
Changes to the Jaspersoft community edition download ×

Hiding a field if no data in database


Recommended Posts

By: Phil - pchar

Hiding a field if no data in database

2006-01-19 07:16

Hello,

 

I would like to hide a label on the report if a field in the datasource is blank. I have tried <printWhenExpression><![CDATA[new Boolean($F{OPHONE}.TRUE)]]></printWhenExpression> but iReport complains with net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. TRUE cannot be resolved or is not a field value = (java.lang.Boolean)(new Boolean(((java.lang.String)field_OPHONE.getValue()).TRUE));

 

Any help appreciated.

 

Thanks!

 

Phil

 

 

 

 

By: Johnny A - sykosity

RE: Hiding a field if no data in database

2006-01-19 15:58

What is with the TRUE that you have in your expression?

 

new Boolean($F{OPHONE}.TRUE) ??

 

 

$F{OPHONE} is a String from what I can tell, why not try something like:

 

new Boolean($F{OPHONE} == null)

 

 

 

 

 

By: Johnny A - sykosity

RE: Hiding a field if no data in database

2006-01-19 16:04

These might be some alternative expressions which might help your cause:

 

Print When String is not null:

new Boolean( $F{OPHONE} != null )

 

Print When String is not blank:

new Boolean( !($F{OPHONE}.equals("")) )

 

hope that helps

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...