How to get max value in a multiple values field by using lotus script

Hi, everyone:

Does anybody know how to get the max value from the multiple values field by using lotus script in an agent? Any help I appreciate!!!

Subject: ubound

Subject: how to get max value in a multiple values field by using lotus script

NotesItem.Values is an array of values. The type of array depends on the datatype of NotesItem. You can use Forall to iterate over this array to find the biggest one. If your Notesitem is numeric, something like thisBiggestSoFar# = 0

Forall v in item.Values

if v > BiggestSoFar# then BiggestSoFar# = v

End Forall

Subject: RE: how to get max value in a multiple values field by using lotus script

Hi, Bob:I appreciate your help!!!

Subject: RE: how to get max value in a multiple values field by using lotus script

With that code you’d wind up with zero (and a lie for a result) if all your values were negatvie. Better would be to initialize BiggestSoFar to item.Values(0) then run your forall loop. :slight_smile:

Subject: RE: how to get max value in a multiple values field by using lotus script

Thanks Jeremiah!I appreciate your help!