gr4nt4 Posted October 15, 2007 Share Posted October 15, 2007 Hi all Using 'Print When Expression' I'm looking to do two things 1. When a field value is above a certain value .. do not print ie somthing like $F{myVal} <=100 then print value else do not print 2.Always hide a field I tried Boolean (true) but an error as you may guess I'm not a java man Thanks for the help Link to comment Share on other sites More sharing options...
lucianc Posted October 15, 2007 Share Posted October 15, 2007 TryCode:Boolean.valueOf($F{myVal}.intValue() <= 100)andCode:[code]Boolean.TRUE If you're not literate in Java you could try using the Groovy or BeanShell compilers as you'd be able to use a simpler syntax. HTH,Lucian Link to comment Share on other sites More sharing options...
gr4nt4 Posted October 15, 2007 Author Share Posted October 15, 2007 Yep that got it many thanks, I'll also take a look at groovy Link to comment Share on other sites More sharing options...
martynhiemstra Posted October 29, 2007 Share Posted October 29, 2007 Hi All I find this really strange. I am using Java 5. In java 5 Boolean and boolean are both allowed and dont need to be casted. According to jasperreports, the printWhen expression must contain valid Java code and must return a boolean. Then why on earth must the print when expression generate Boolean and not boolean. For example: $F{FieldName} != null (Mot allowed)new Boolean($F{FieldName} != null) (Is allowed) That is really strange behavior because in Java 5 it would be $F{FieldName} != null (Is allowed)new Boolean($F{FieldName} != null) (Is allowed) Could someone explaing this please? Link to comment Share on other sites More sharing options...
lucianc Posted October 29, 2007 Share Posted October 29, 2007 If you use the JDT-base compiler, you need to instruct it to compile 1.5 code. You can read how to do that here. HTH,Lucian Link to comment Share on other sites More sharing options...
martynhiemstra Posted October 29, 2007 Share Posted October 29, 2007 Hi Lucianc Thanks for your quick response. In short for those of you who dont want to follow the link: To compile Java 1.5 code with this compiler, you might need to explicitly set the following properties in your jasperreports.properties file: Code:org.eclipse.jdt.core.compiler.source=1.5org.eclipse.jdt.core.compiler.compliance=1.5org.eclipse.jdt.core.compiler.codegen.TargetPlatform=1.5 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