fmalaj Posted February 7, 2019 Share Posted February 7, 2019 Hello, 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 More sharing options...
carmines_zachary Posted February 7, 2019 Share Posted February 7, 2019 Hi fmalaj, staticText elements are not meant to be changed programmatically. Have you tried changing the element to a textField? Link to comment Share on other sites More sharing options...
Solution hozawa Posted February 7, 2019 Solution Share Posted February 7, 2019 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 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