Documentation

DSum extends DatabaseAbstract
in package

Table of Contents

Methods

evaluate()  : null|float|string
DSUM.
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()  : string

Methods

evaluate()

DSUM.

public static evaluate(array<string|int, mixed> $database, null|array<string|int, mixed>|int|string $field, array<string|int, mixed> $criteria[, bool $returnNull = false ]) : null|float|string

Adds the numbers in a column of a list or database that match conditions that you specify.

Excel Function: DSUM(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 : null|array<string|int, mixed>|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.

$returnNull : bool = false
Return values
null|float|string

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) : string
Parameters
$criterion : string
$fields : array<string|int, mixed>
$dataValues : array<string|int, mixed>
$conditions : string
Return values
string

        
On this page

Search results