Documentation

DVar extends DatabaseAbstract

Table of Contents

evaluate()  : float|string
DVAR.
fieldExtract()  : int|null
fieldExtract.
filter()  : array<string|int, mixed>
filter.
getFilteredColumn()  : array<string|int, mixed>
buildCondition()  : string
buildQuery()  : string
executeQuery()  : array<string|int, mixed>
processCondition()  : mixed

Methods

evaluate()

DVAR.

public static evaluate(array<string|int, mixed> $database, int|string $field, array<string|int, mixed> $criteria) : float|string

Estimates the variance of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify.

Excel Function: DVAR(database,field,criteria)

Parameters
$database : array<string|int, mixed>

The range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.

$field : int|string

Indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.

$criteria : array<string|int, mixed>

The range of cells that contains the conditions you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return values
float|string

(string if result is an error)

fieldExtract()

fieldExtract.

protected static fieldExtract(array<string|int, mixed> $database, mixed $field) : int|null

Extracts the column ID to use for the data field.

Parameters
$database : array<string|int, mixed>

The range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.

$field : mixed

Indicates which column is used in the function. Enter the column label enclosed between double quotation marks, such as "Age" or "Yield," or a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.

Return values
int|null

filter()

filter.

protected static filter(array<string|int, mixed> $database, array<string|int, mixed> $criteria) : array<string|int, mixed>

Parses the selection criteria, extracts the database rows that match those criteria, and returns that subset of rows.

Parameters
$database : array<string|int, mixed>

The range of cells that makes up the list or database. A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.

$criteria : array<string|int, mixed>

The range of cells that contains the conditions you specify. You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.

Return values
array<string|int, mixed>

getFilteredColumn()

protected static getFilteredColumn(array<string|int, mixed> $database, int|null $field, array<string|int, mixed> $criteria) : array<string|int, mixed>
Parameters
$database : array<string|int, mixed>
$field : int|null
$criteria : array<string|int, mixed>
Return values
array<string|int, mixed>

buildCondition()

private static buildCondition(mixed $criterion, string $criterionName) : string
Parameters
$criterion : mixed
$criterionName : string
Return values
string

buildQuery()

private static buildQuery(array<string|int, mixed> $criteriaNames, array<string|int, mixed> $criteria) : string
Parameters
$criteriaNames : array<string|int, mixed>
$criteria : array<string|int, mixed>
Return values
string

executeQuery()

private static executeQuery(array<string|int, mixed> $database, string $query, array<string|int, mixed> $criteria, array<string|int, mixed> $fields) : array<string|int, mixed>
Parameters
$database : array<string|int, mixed>
$query : string
$criteria : array<string|int, mixed>
$fields : array<string|int, mixed>
Return values
array<string|int, mixed>

processCondition()

private static processCondition(string $criterion, array<string|int, mixed> $fields, array<string|int, mixed> $dataValues, string $conditions) : mixed
Parameters
$criterion : string
$fields : array<string|int, mixed>
$dataValues : array<string|int, mixed>
$conditions : string
Return values
mixed

Search results