\PhpOffice\PhpSpreadsheet\Calculation\DatabaseDGet

Summary

Methods
Properties
Constants
evaluate()
No public properties found
No constants found
fieldExtract()
filter()
getFilteredColumn()
No protected properties found
N/A
buildQuery()
buildCondition()
executeQuery()
processCondition()
No private properties found
N/A

Methods

evaluate()

evaluate(array  $database, int|string  $field, array  $criteria) : mixed

DGET.

Extracts a single value from a column of a list or database that matches conditions that you specify.

Excel Function: DGET(database,field,criteria)

Parameters

array $database

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.

int|string $field

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.

array $criteria

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.

Returns

mixed —

fieldExtract()

fieldExtract(array  $database, mixed  $field) : ?int

fieldExtract.

Extracts the column ID to use for the data field.

Parameters

array $database

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.

mixed $field

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.

Returns

?int —

filter()

filter(array  $database, array  $criteria) : array

filter.

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

Parameters

array $database

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.

array $criteria

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.

Returns

array —

of mixed

getFilteredColumn()

getFilteredColumn(array  $database, ?int  $field, array  $criteria) : array

Parameters

array $database
?int $field
array $criteria

Returns

array —

buildQuery()

buildQuery(array  $criteriaNames, array  $criteria) : string

Parameters

array $criteriaNames
array $criteria

Returns

string —

buildCondition()

buildCondition(mixed  $criterion, string  $criterionName) : string

Parameters

mixed $criterion
string $criterionName

Returns

string —

executeQuery()

executeQuery(array  $database, string  $query, array  $criteria, array  $fields) : array

Parameters

array $database
string $query
array $criteria
array $fields

Returns

array —

processCondition()

processCondition(string  $criterion, array  $fields, array  $dataValues, string  $conditions) : mixed

Parameters

string $criterion
array $fields
array $dataValues
string $conditions

Returns

mixed —