Returns the mode (most often occurring value) of a field or array. This is equivalent to nthMostFrequent(1).
Mode( fld ) Mode( fld, condFld ) Mode( fld, condFld, cond )
fld | The name of a field or array variable whose values should be used to calculate the mode value. |
---|---|
condFld | The name of the field that groups the values of fld (if fld isn't an array). |
cond | A string declaring the type of grouping to be used on condFld. This only makes sense for groups based on Date, DateTime, Time, and Boolean fields. See Summary Field Conditions for a list of strings you can use here. |
A number.
//returns the mode value of the array mode([1,2,5,3,2,9,2,4,3,2,5,7,8,5,1,2,6,4]) //returns 2
//returns the mode of the database field mode({Failures.Reason})
//returns the mode Sales_Amount grouped by Vendors.Vendor mode({Failures.Reason, Vendors.Vendor})
//a formula that depends on the mode value of Sales_Amount numberVar nth = mode(10, {Failures.Reason}); if {Failures.Reason} > nth then red else black