Jump to content
Changes to the Jaspersoft community edition download ×

Textfield displays null


2005 IR Help

Recommended Posts

By: Chris Germano - netslayer

Textfield displays null

2005-02-11 08:32

I'm using the option 'blank when null' Now this works fine for textfields with just the $F{} field in it. So if the actual field is null it will be blank. However I need a field that is like $F{firstName} + ", "+ $F{lastName} and if any of those are null the field won't go blank because of the inserted "." string. It will just display "null, null" which looks ridiculous.

 

What can I do about this? If I split the columns up then I lose the length of the merged cell because a first name can be longer then a last name and vice versa.

 

 

 

 

By: Wal Millard - walmillard

RE: Textfield displays null

2005-02-14 14:23

Chris,

 

You have 2 options.

 

1) You can declare a String Variable for each name, and check each field value before adding the field to the string, like this in the variable expression...

 

$F{lastName}.equals("null")?(""):(", " + $F{lastName})

 

Then Display the $V{} instead of the $F{} on your report.

 

2) In the Print When expression you can add something like...

 

new Boolean(!$F{firstName}.equals("null") && !$F{lastName}.equals("null"))

 

luck

walmillard

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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