adam_7 Posted November 12, 2015 Share Posted November 12, 2015 Hello All,I am not very good when it comes to java and i was hoping someone could help me with some conditional formatting in a report.I have two columns that both contain BigDecimal values. One columns is the averages sales per day (over the past 60 days), and the second column is the total sales over the past 3 days.I would like to create a conditional style that highlights the 3 day sales value if it is over 3 times larger than the average day sales. This is to show a recent influx of sales on a product over the past 3 days compared to the typical average.Here is an exmple of the simple math expressions:if (3 day total) > (60 day average x 3) - highlight greenI am pretty sure i can set up the styles how i want, i just dont know how to take the above math expression and actually create a java expression out of it. Any help or advice would be appreciated. Link to comment Share on other sites More sharing options...
plambert_1 Posted November 12, 2015 Share Posted November 12, 2015 Indeed you can set a conditionnal style with such an expression.in your case the conditionnal expression would simply look like : $F{3daysTotal}>3*$F{60daysAverage} Link to comment Share on other sites More sharing options...
adam_7 Posted November 12, 2015 Author Share Posted November 12, 2015 I get undefined operators when i try to use > or * in the expression. That was my problem when trying to get the expression set up. I think it wants me to use java expressions like this from a different report i have:($V{Margin}.divide($V{Adjusted Retail}) Link to comment Share on other sites More sharing options...
Solution plambert_1 Posted November 13, 2015 Solution Share Posted November 13, 2015 If the fields are BigDecimal you can also cast them to Integer or Float first with BigDecimal.intValue() and BigDecimal.floatValue() Link to comment Share on other sites More sharing options...
adam_7 Posted November 13, 2015 Author Share Posted November 13, 2015 Casting as float allowed me to use the * and > expressions. 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