{{sidenavigation.sidenavigationExpandLabel}}
{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}} {{helpModel.downloadHelpPdfDataStatus}}

Mode

Returns the mode (most often occurring value) of a field or array. This is equivalent to nthMostFrequent(1).

Usage:

Mode( fld )
Mode( fld, condFld )
Mode( fld, condFld, cond )

Parameters:

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.

Returns:

A number.

Examples:

//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

Notes:

  • If the values in fld should be grouped, a group based on condFld is needed. If the group does not exist in the report, you can add it using i-net Designer or using API method: Engine.addGroup.
  • If there are two or more most frequent values, the smallest of them will be returned.

See also:

i-net Clear Reports
This application uses cookies to allow login. By continuing to use this application, you agree to the use of cookies.


Help - Mode