Jump to content
Changes to the Jaspersoft community edition download ×

Update Static Text based on text field

Go to solution Solved by hozawa,

Recommended Posts


I'm working on Jaspersoft Studio and I want to update a Static Text Field based on owner field i receive from the database.  Lets say if owner is equsl to "JTI" then display "Ref Number" else display "Item Num" as static text. 

This is what I tried putting in Print When Expression: $F{OWNER}.equals("JTI") ? "Ref Number" : "Item Num" for the static text field but I'm getting the error java.lang.String cannot be case to Java.lang.Boolean. 

Can someone help me with this? 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution

Use regular text field instead of static text component. *static* means you can't change it with value from a database.

Also, Print When Expression is used to put an expression that is used to determine whether to display the text or not.

What you want to do is use a regular text component and put your expression in the regular expression field.

Link to comment
Share on other sites

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