CDBResult CSaleUserAccount::GetList( array arOrder = array(), array arFilter = array(), array arGroupBy = false, array arNavStartParams = false, array arSelectFields = array() );
The method GetList returns a selection of accounts according to the specified criteria.
Parameter | Description |
---|---|
arOrder | Associated array used to sort the resulting records. The array has the following
format:array( "field_name1" => "sort_order1", "field_name2" => "sort_order2", . . . )The fields field_nameN can be any field of an account. The sort_orderX can be either "ASC" (ascending) or "DESC" (descending). If the sorting array has more than one elements, the resulting list is sorted by each element in series (i.e. the list is first sorted by the first element, then the result is sorted by the second element etc). The default value is an empty array() which means that the result will not be sorted. |
arFilter | Associated array used to filter the records of accounts. The array has the following format:array( "[modifier1][operator1]field_name1" => "value1", "[modifier2][operator2]field_name2" => "value2", . . . )Records satisfying the filter conditions are returned as a result, others are truncated. The following modifiers are possible:
Example: array("USER_ID" => 150)This filter tells to "return all records with the value 150 in the USER_ID field". The default value is an empty array() which means that the result will not be filtered. |
arGroupBy | Associated array used to group the records of accounts. The array has the following format:array("field_name1", "grouping_function2" => "field_name2", ...)The fields field_nameN can be any field containing information about an account. The grouping_functionX can be one of the following:
The default value is false which means that the result will not be grouped. |
arNavStartParams | Array of the selection parameters. The following keys are possible in this array:
|
arSelectFields | Array of record fields that will be returned by the method. You may
specify the required fields only. If the array contains the value of
"*", all available fields will be returned. The default value is an empty array() which means that all the fields of the main query table will be returned. |
The method returns an instance of the CDBResult class, containing the list of associated arrays with parameters of accounts:
If an empty array is passed as an arGroupBy parameter, the method will return the number of records satisfying the filter.
<? // Select all accounts (with different currencies) of the user #21 $dbAccountCurrency = CSaleUserAccount::GetList( array(), array("USER_ID" => "21"), false, false, array("CURRENT_BUDGET", "CURRENCY") ); while ($arAccountCurrency = $dbAccountCurrency->Fetch()) { echo "Current balance ".$arAccountCurrency["CURRENCY"].": "; echo SaleFormatCurrency($arAccountCurrency["CURRENT_BUDGET"], $arAccountCurrency["CURRENCY"])."<br>"; } // Obtain the total amount of the users' accounts $dbAccountCurrency = CSaleUserAccount::GetList( array("CURRENCY" => "ASC"), array(), array("CURRENCY", "SUM" => "CURRENT_BUDGET"), false, array("CURRENCY", "SUM" => "CURRENT_BUDGET") ); while ($arAccountCurrency = $dbAccountCurrency->Fetch()) { echo "Currency ".$arAccountCurrency["CURRENCY"].": "; echo SaleFormatCurrency($arAccountCurrency["CURRENT_BUDGET"], $arAccountCurrency["CURRENCY"])."<br>"; } ?>
© 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |