Documentation

GetList

Description and parameters

CDBResult
CSaleAuxiliary::GetList(
 array arOrder = array(),
 array arFilter = array(),
 array arGroupBy = false,
 array arNavStartParams = false,
 array arSelectFields = array()
);

Method returns records with information on temporary access according to its parameters. Non-static method.

Call parameters

ParameterDescription
arOrder Array with sorted resulting records. Array has the following appearance:
array(
"field_name1" => "sorting_direction1",
"field_name2" => "sorting_direction2",
. . .
)
Any field can be set as "field_nameN" with information on temporary access, and "sorting_directionN" can have values "ASC" (by ascension) and "DESC" (by descension).

In case the array with sorting has several elements, the resulting set is sorted sequentially by each element (i. e. first sorts by the first element, then the result is sorted by the second and etc.). 

Default value - empty array() - indicates that result won't be sorted.
arFilter Array for sorting record information on temporary access. Array has the following appearance:
array(
"[modifier1][operator1]field_name1" => "value1",
"[modifier2][operator2]field_name2" => "value2",
. . .
)
Returns records that satisfy the filter. The records that don't satisfy filter conditions are dismissed.

The following modifiers are permitted:
  • ! - negation;
  • + - values null, 0 and empty string do not satisfy filter conditions.
The following operators are permitted:
  • >= - field value is higher or equal to the value passed to the filter;
  • > - field value is strictly higher than the value passed to the filter;
  • <= - field value is less or equal to the value passed to the filter;
  • < - field value is strictly less than value passed to the filter;
  • @ - field value is located in the comma-separated list of values passed to the filter;
  • ~ - field value is verified according to the template passed to the filter;
  • % - field value is verified for the match to the string passed to the filter according to the query language.
The "field_nameN" can have any field with information on temporary.

Filter example:
array("USER_ID" => 150)
This filter indicates "select all records with USER_ID value (user code) is 150".

Default value - empty array() - indicates that result won't be filtered.
arGroupBy Array with fields used to group the records on temporary access. Array looks as follows:
array("field_name1",
      "group_function2" => "field_name2", . . .)
The "field_nameN" can have any field with information on temporary access. The following values can be indicated as the grouping function:
  • COUNT - quantity count;
  • AVG - average value calculation;
  • MIN - minimal value calculation;
  • MAX - maximum value calculation;
  • SUM - total calculation.
If array is empty method returns number of records satisfying the filter.

Default value - false - indicates that the result won't be grouped.
arNavStartParams Array with retrieved selection parameters. Can contain the following keys:
  • "nTopCount" - number of records, returned by the method will be limited by the top count number indicated in this key;
  • any key, received by the method CDBResult::NavQuery as the third parameter.
Default value - false - indicates no retrieved selection parameters.
arSelectFields Array of record fields to be returned by the method. Only necessary fields can be indicated. If the array contains the value "*", returns all the available fields.

Default value - empty array array() - indicates that all fields of the query's main table will be returned.

Returned values

Returns CDBResult class object, containing set of associative parameters with information on temporary access with keys as follows:

  • ID - record code;
  • USER_ID - user code;
  • ITEM - resource, with permitted access;
  • ITEM_MD5 - resource identifier (string, with single resource identification);
  • TIMESTAMP_X - timestamp;
  • DATE_INSERT - date of inserted record.

When passing an empty array as arGroupBy parameter, the method returns number of records, satisfying the filter.


© «Bitrix24», 2001-2024
Up