Jump to content

Max Value


silvi

Recommended Posts

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

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...