|
Parameter | Value | Default | Description |
---|---|---|---|
amount | any decimal | 20.99 | the calculation of the amount |
sourceCurrency | 3-letter ISO 4217 currency code | CAD | source currency,which currency is the amount in?. The three-letter currency code for Amount |
exchangeRatesTrackerId | number | 50 | the currency field of the tracker |
samerow | 0 or 1 | 0 | Will display the next field or checkbox in the same row if set to 1 |
size | number of charcters | 17 | The visible size of the field in characters |
prepend | any text | none | Text that will be displayed before the field |
append | any text | none | Text that will be displayed just after the field |
locale | language_country code, for example en_US or en_US.UTF-8 or en_US.ISO-8559-1 | en_US | This language code (ISO 639) + country code (ISO 6339) determines how decimals are displayed and what thousands separator is used |
defaultCurrency | 3-letter ISO 4217 currency code | USD | The three-letter currency code that will display as convert currency |
symbol | i or n | n | Set to i for international symbol, n for local |
all_symbol | 0 or 1 | 0 | Set to 1 to show symbol for every item (default only shows currency symbol on first item in a list) |
locale set to fr_CA (language = French country = Canada) |
locale set to ja_JP (language = Japanese country = Japan) |
locale set to de_DE (Germany) symbol set to i all_symbol set to 1 |
In Tiki19, this field was improved so it can track values in any currency, and on mouse-over, show the equivalent value in other currencies. This is very useful if you need to track items in many currencies. For example, you get paid in more than one currency, and you'd like to know the value in other currencies.
The exchange rates are stored in a tracker. You can set date ranges for exchange rates.
This field had a bunch of incremental fixes and enhancements in branch 20.x in September 2019, so if you intend to use seriously, you should probably get the Daily Build or from SVN.
{currency amount=20.99 sourceCurrency=CAD exchangeRatesTrackerId=50 prepend= append= locale=en_US.UTF-8 defaultCurrency=USD symbol=n allSymbol=0}
All currency fields now have another index field named permName_base. It contains a numeric value of the amount converted to base currency. Base currency is the currency with rate = 1 in the currency tracker. If you need multiple base currencies, you could use multiple currency trackers each having a different rate = 1 currency. Then, some currency fields will use one currency tracker and others will use the other one.
Sorting: use the "_base" suffix currency field in a LIST context and sort on that.
victor.emanouilov 2020-04-15
https://gitlab.com/tikiwiki/tiki/-/commit/c512d9e12c360e5dce9dcddadf768d28c07c21a1
A couple of updates here that were needed before adding the range filters:
1. Added base currency field to the index - this is taken from the currency tracker - the currency unit that has conversion rate = 1. Each currency field now has its value indexed as text value (e.g. 123USD) and also has a "_base" suffix one that is a numeric value of the amount in the base currency. You should keep one and only one currency with rate = 1 in the currency tracker and that would be the base currency. We will use this later on when we sort and do other operations with currencies.
2. Extended math field to inherit indexable fields from its mirrored field. In case of a currency mirror, this will allow the math field to also have the "_base" suffix field in the index, so calculations of currencies will also store the base currency value in the index.
3. Extended currency field to support range filters - from/to value and from/to currency. This is similar to tracker filters and also similar to the currency field input, so it makes most sense to use it here. Chosen amount and currency is converted to the base currency and then "_base" index field is searched as a numeric range search.
Thus, all the updates here depend on the presence of a base currency with rate = 1 in the currency tracker.
There is a new section in Control Panels > Trackers > 'System Trackers' (bottom of the page).
The first one available is the Exchange rates tracker.
You can enable it, select which one it is, select the corresponding fields (Currency, Rate, Date) and also the conversion logic (if the rates are entered straight or reverse pairs). An important update here is removal of the Currency Tracker selection in the Currency field options. We no longer need or want to use that from the field properties as we have a system tracker now. The important part for those of you managing Currency fields is to go to Trackers settings page and configure the system tracker fields.
See System Trackers
Also see Currency Tracker Profile