brian.berrelez Posted August 3, 2017 Share Posted August 3, 2017 I'm trying to conditionally format a value on my report if it is negative but I am not able to evaluate if a value is less than Zero or not.I'm still new to Jaspersoft. Here is my custom formatting method.<style name="NegativeAverage"> <conditionalStyle> <conditionExpression> <![CDATA[new Boolean($F{AVERAGE_BALANCE} < 0.00 ? Boolean.TRUE : Boolean.False]]> </conditionExpression> <style isBold="true"/> </conditionalStyle></style>[/code]Errors:Errors were encountered when compiling report expressions class file: 1. Syntax error, insert ")" to complete Expression value = new Boolean(((java.math.BigDecimal)field_AVERAGE_BALANCE.getValue()) < 0.00 ? Boolean.TRUE : Boolean.False; //$JR_EXPR_ID=14$ <---> 2. Syntax error, insert ")" to complete Expression value = new Boolean(((java.math.BigDecimal)field_AVERAGE_BALANCE.getOldValue()) < 0.00 ? Boolean.TRUE : Boolean.False; //$JR_EXPR_ID=14$ <---> 3. Syntax error, insert ")" to complete Expression value = new Boolean(((java.math.BigDecimal)field_AVERAGE_BALANCE.getValue()) < 0.00 ? Boolean.TRUE : Boolean.False; //$JR_EXPR_ID=14$ <---> 3 errors[/code]Any help is greatly appreciated. Link to comment Share on other sites More sharing options...
Solution brian.berrelez Posted August 3, 2017 Author Solution Share Posted August 3, 2017 <conditionalStyle> <conditionExpression> <![CDATA[new Boolean($F{AVERAGE_BALANCE}.compareTo(BigDecimal.ZERO) < 0 ? Boolean.TRUE : Boolean.FALSE)]]> </conditionExpression> <style forecolor="#FF0000"/> </conditionalStyle> [/code] 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