Jump to content

Trying to add conditions to report


2005 IR Help

Recommended Posts

By: Eric - netizen1

Trying to add conditions to report

2004-06-18 11:44

I'm very new to Jasper and like what i see so far. I even bought the docs. But the one thing i cant seem to find information on is how to do conditions on text fields.

Ex. I have a field $F{FirstName} and i want to do the following if condition on it:

 

if($F{FirstName}.equals("Eric")

print "This is person 1"

else if ($F{FirstName}.equals("John")

print "This is person 2"

else if($F{FirstName}.equals("Dave")

print "This is person 3"

else if($F{FirstName}.eqausl("Mike")

print "This is person 4"

else

print "Person 5"

 

I have seen some samples but nothing that goes beyond and if/else.

 

Thanks in advance

 

 

 

 

By: C-Box - c-box

RE: Trying to add conditions to report

2004-06-18 13:26

Well the easiest way ( I guess) is, to write a scriptlet and you use a method like "getPrintStringByFirstName($F{Firstname)"....

 

and in that scriptlet you can decide what string should be returned for what firstname.

 

hth

C-Box

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