silvi Posted October 5, 2011 Share Posted October 5, 2011 Hello all, I need help and guidance of experts in i-report for a newbie. I need a variable (or text expression) having one maximum value from all the fileds. For ex: I have four fields. Let's say A , B, C , D . So the variable should get maximum value from all these fields. A > B> C > D. All these are an integer. I am able to get the maximum value for a field like A . But I am not able to get the maximum value from all the fields. How can I get this? I tried various text expressions but no luck. Please help, it's very urgent and important for me. Thanks in advance Silvi Link to comment Share on other sites More sharing options...
lknueve Posted October 5, 2011 Share Posted October 5, 2011 Best way I can think of is to have 4 separate variables - one for each field (a, b, c, d) that pulls the max (highest) value, make sure to set the evaluation time to Report....then have the text field you're displaying the highest value from all four fields set evaluation time to Report, and have something like following in expression: $F{a} >= $F{b} ? --if a > b then check value of c $F{a} >= $F{c} ? --if a > b and a > c then check value of d $F{a} >= $F{d} ? $F{a} --if a > b and a > c and a > d then a : $F{d} --if a > b and a > c but d > a then d : $F{c} >= $F{d} ? $F{c} --if a > b but c > a then check value of d -> if a > b but c > a and c > d then c : $F{d} --if a > b but c > a but d > c then d : $F{b} >= $F{c} ? --if b > a and b > c then check value of d $F{b} >= $F{d} ? $F{b} --if b > a and b > c and b > d then b : $F{d} --if b > a and b > c but d > b then d : $F{c} >= $F{d} ? $F{c} --if b > a but c > b then check value of d -> if b > a but c > b and c > d then c : $F{d} --if b > a but c > b but d > c then d if there is a function that does this already, I'm not aware of it. Link to comment Share on other sites More sharing options...
silvi Posted October 6, 2011 Author Share Posted October 6, 2011 Thanks for your response. It works. 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