You can use JavaScirpts' 'Math.max()' function to get the maximum value of 2 numbers.
You will have to write a control loop compare each pair of values to get the maximum value. A couple of functions will provide enough flexibility to compute the maximum value from an array of field names or values.
Document level functions to determine maximum value from an array of values or field names:
function Max(fX, fY){// return maximum value of 2 valuesreturn Math.max(fX, fY);}// end max functionfunction MaxArrayV(aValues){// return max value from an array of valuesvar fMax = aValues[0];// establish base value// loop through array of values for(i =0; i < aValues.length; i++){// on process non null fields and only numbersif(aValues[i]!=''&!isNaN(aValues[i])){fMax = Max(fMax, aValues[i]);}// end not null}// end loopreturn fMax;}// end MaxArrayfunction ValueArrayFN(aFieldNames){// return array of values from list of field names// define array for valuesvar aValues =new Array(aFieldNames.length);// populate the arrayfor(i =0; i < aFieldNames.length; i++){aValues[i]=this.getField(aFieldNames[i]).value;}return aValues}// end ValueArrayFN function
Custom calculation script for field names:
// array of field names to compare valuesvar aNames =new Array("Text1.0","Text1.1","Text1.2","Text1.3");event.value= MaxArrayV(ValueArrayFN(aNames));// orevent.value= MaxArrayV(ValueArrayFN(["Text1.0","Text1.1","Text1.2","Text1.3"]));
You will have to write a control loop compare each pair of values to get the maximum value. A couple of functions will provide enough flexibility to compute the maximum value from an array of field names or values.
Document level functions to determine maximum value from an array of values or field names:
Custom calculation script for field names:
George Kaiser