MEDIAN

Returns the median of the values displayed in the rows of the table controls. For example, if there are 5 rows containing values for UnitPrice as 57, 32, 12, 19, and 98, then the median is the number which falls in the middle after arranging the values in ascending order. In this case the median is 32.

The function accepts values only from textbox, label and literal controls. In cases where the number of values are even, the median is the average of the two middle numbers. This function is called as <TableControlName>.MEDIAN("<ControlName>"). Use a TableControl instance to indicate which TableControl contains the values to be operated on by the function (e.g., Order_DetailsTableControl, ProductsTableControl, CategoriesTableControl).

Syntax

= <TableControlName>.MEDIAN(controlName)

Parameters

controlName

It represents the name of the control which contains the values whose median is to be calculated. The controlName should be a string (e.g., “UnitPrice”, “Quantity”, “Discount”). The values in the control can be an integer (e.g., 37), a decimal value (e.g., 37.48), or a string.

Return Type

Decimal

Examples

Example

Returns

= ProductsTableControl.MEDIAN(“UnitsInStock”)

The median of the values displayed in the rows of the “UnitsInStock” control.

= Order_DetailsTableControl.MEDIAN("Quantity")

The median of the values displayed in the rows of the “Quantity” control.

= Order_DetailsTableControl.MEDIAN("Discount")

The median of the values displayed in the rows of the “Discount” control.