dprogrammer Posted March 10, 2022 Share Posted March 10, 2022 Hello Friends, I have a veriable that sums of values based upon two conditions. If I use both conditions, the value is coming up 0. However if I only leave one condition, I get a value. What could be wrong?($F{city}.equalsIgnoreCase ("NEW YORK") && $F{city_zip}.equals (10001) )? $F{sales_amount}:0I have data where both conditions are true yet the variable is not summing up the values. If I just use one condition in the expression, then I am getting values. Do I need to create group on the condition fields? I am resetting the variable at report level Link to comment Share on other sites More sharing options...
C-Box Posted March 12, 2022 Share Posted March 12, 2022 Have you already checked, if one of the fields is NULL??Try to change the order of the expression to: (not sure whether your ZIP is plain int or Integer or String, that's why my convert to String):"NEW YORK".equalsIgnoreCase($F{city}) && ("10001").equals(String.valueOf($F{city_zip})) ? $F{sales_amount}:0 by default, Jasper is not null-safe... so you should be aware of correct order for equals-comparisonshth + regardsC-Box Link to comment Share on other sites More sharing options...
shreekrishna.shankhwar Posted May 12, 2022 Share Posted May 12, 2022 Try to change the order of the expression to: (not sure whether your ZIP is plain int or Integer or String, that's why my convert to String):"NEW YORK".equalsIgnoreCase($F{city}) && ("10001").equals(String.valueOf($F{city_zip})) ? $F{sales_amount}:0by default, Jasper is not null-safe... so you should be aware of correct order for equals-comparisonsas above answer continuity i am adding this . the mentioned expression should go into variable and use reset sum and average option to get your total . if you need more clarity on this i will send you the sample example 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