In french: eChangeDevise
Converts a currency into another currency.
: The converted currencies can differ from the Euro. For the conversions into Euros, use eToCurrency
: In browser code, eChangeCurrency
is used to perform approximate calculations without refreshing the page on the server (save time during Internet connections). The precision of the calculations performed in browser code does not correspond to the Euro standard. To perform precise calculations, we advise you to send the page back to the server and to perform the calculations in a server code.
// Convert French Francs into Marks
ResConversion = eChangeCurrency(150, eFRF, eDEM)
<Result> = eChangeCurrency(<Value to convert> , <Source currency> , <Destination currency> [, <Number of decimals> [, <Rounding difference>]])
Value converted into the specified currency.
This parameter is a real.
<Value to convert>: Currency
Amount to convert. This value is converted:
- from the <Source Currency> to the currency whose identifier is "0" (the Euro by default),
- from the currency whose identifier is "0" (the Euro by default) to the <Destination Currency>.
This parameter is a real.
<Source currency>: Integer or constant
Identifier of the source currency or constant associated with the source currency (see the Notes).
<Destination currency>: Integer or constant
Identifier of the destination currency or constant associated with the destination currency (see the Notes).
<Number of decimals>: Optional integer
Number of decimal places used for the result of the conversion (2 by default).
<Rounding difference>: Optional currency
Variable retrieving the rounding difference caused by the conversion. This difference is expressed in the source currency.
This parameter is not available. No rounding difference can be retrieved.
An exchange table is stored in memory. Each currency is associated with:
- A currency number used to identify the currency by programming.
- A constant used to identify the currency by programming.
- A caption (up to 7 characters): this caption is displayed in the "Currency + Euro" control if the input mask allows it (the $ sign is indicated).
- An exchange rate. This exchange rate corresponds to the exchange rate of the currency in relation to the Euro.
This exchange table is as follows:
|Currency number||Constant||Country||Exchange rate||Default caption|
|Currencies not taking part in the Euro|
|16 - 25||0||Free1 to Free10|
The first currency (whose identifier is set to 0) is the currency used as reference for the conversions.
In this exchange table, you have the ability to:
- add new currencies by modifying the custom currencies if necessary ("user-defined currencies" from 16 to 25) with eInitCurrency,
- specify the exchange rate of each currency with eInitCurrency.
: The currencies whose exchange rate is set to 0 will not be displayed in the context menu of the "Currency + Euro" control. To define the exchange rate of these currencies, you must redefine them in the initialization code of the project with eInitCurrency
The <Rounding difference> is calculated by the following formula:
Round(<Value to convert>, <Result in source currency>, <Number of decimals>)
Difference is currency
ResConversion is currency
ResConversion = eChangeCurrency(1.52, eFRF, eDEM, 2, Difference)
ResConversion is set to 0.45 and Difference is set to 0.01.
The following line of code allows you to retrieve the initial amount:
InitialAmount = eChangeCurrency(ResConversion, eDEM, eFRF, 2) + Difference
This page is also available for…