Page 1 of 1
find largest value
Posted: Thu Apr 15, 2010 3:54 am
by Ron Zellner
Anyone know of a quick way to determine the largest value in a row or column in a table? (numerical data)
(Other than setting up repeats and comparing a series of pairs )
Thanks,
Ron
Re: find largest value
Posted: Thu Apr 15, 2010 4:03 am
by sturgis
Well, for a row it would be pretty easy. Since tables are tab delimited, put the line in question into a variable, replace tab with comma in the variable so that its a number list, and use the max() function.
For column, I believe you do need a repeat, off the top of my head something like
Code: Select all
repeat for each line theLIne in field "tablefield"
put item 3 of theLIne & comma after tempVar -- build the number list
end repeat
delete the last char of tempVar -- cut the trailing comma
get max(tempVar) -- find the max
edit: Forgot, you need to set the itemdelimiter to tab for this to work. Add a line like
set the itemdelimiter to tab above the start of the repeat.
Re: find largest value
Posted: Thu Apr 15, 2010 4:16 am
by Ron Zellner
That's embarrassing- I forgot about the Max() function

-! Use it all the time in Excel, etc.
Guess it's time to stop for the night.