Bitrix Site Manager

CCurrencyRates::GetList

CDBResult
CCurrencyRates::GetList(
 string &by, 
 string &order, 
 array arFilter = Array()
);

The method GetList returns the sorted list of exchange rates satisfying the specified filter.

Parameters

ParameterDescription
by Variable containing the name of the sorting field. The following values are possible:
  • date - date of the rate (default);
  • curr - currency field;
  • rate - rate field.
order Variable containing sort direction. The following values are possible:
  • asc - ascending (default);
  • desc - descending.
arFilter Record filter in the form of an associated array in which keys are the names of filtered fields and values are the filter conditions.

The following filter fields are possible:
  • CURRENCY - the currency identifier;
  • DATE_RATE - the date of the rate (records containing dates later or equal to the specified one are chosen);
  • !DATE_RATE - the date of the rate (records containing earlier dates than the specified one are chosen).

Return Values

An instance of the CDBResult class containing the records with the following keys.

Key Description
ID The rate ID.
CURRENCY The currency identifier.
DATE_RATE The date for which the rate is set.
RATE_CNT The number of currency units used to define the rate of exchange (for example, if CYP 10 equal to USD 21.58, 10 is the number of currency units).
RATE The default rate of exchange. (One of currencies within a site must equal to 1. Such currency is called a base currency. Other currencies are defined relative to the base currency.)

Example


<?
// Display all USD rates, sorted by date
$arFilter = array(
    "CURRENCY" => "USD"
    );
$by = "date";
$order = "desc";

$db_rate = CCurrencyRates::GetList($by, $order, $arFilter);
while($ar_rate = $db_rate->Fetch())
{
    echo $ar_rate["RATE"]."<br>";
}
?>