The Currency/measure client control shows a combination of a value and a unit. For example, the value "5" has no context without the unit "$". When grouping the value and unit into a combination, it also saves space, and ensures that both are shown with one another.
Figure 1 - Currency/Measure control with value and unit as one combination.
Figure 2 - Currency/Measure control (read-only mode).
Figure 3 - Currency/Measure control (edit mode).
Currency/Measure can be added either as a currency or a measure control. The functionality is the same regardless if it is added to use currency or measure, but it is recommended to only use currency when the unit is a currency, and measure for other value/unit combinations.
Use a Currency/Measure client control to show a value and unit as one combination. When a value and unit are combined, it is still possible to change each of them individually, or make only one of them editable.
In IFS applications there is also a basic data setup for both Currency Codes
and Unit of Measure
. When these data setups are applied, it ensures that only valid currencies and unit of measures are used.
Currency/Measure can be placed in groups, lists, selectors and cards.
The steps below describes how to add a currency/measure client control to a page:
attributes { ... public EntryFee NUMBER A-IU-; public CurrencyCode TEXT(3)/UPPERCASE A-IU-; }
entityset IsoCurrencyEntitySet for IsoCurrency; entityset IsoUnitSet for IsoUnit;
currency EntryFee(CurrencyCode) { unitlookup IsoCurrencyEntitySet(CurrencyCode); unitselector IsoCurrencySelector; } selector IsoCurrencySelector for IsoCurrency { static CurrencyCode; }
The unit can be set to read-only, which makes it possible to only change the value on the field, but not the currency/measure unit.
NOTE! It is not necessary to define the property unitlookup
when the unit is read-only.
uniteditable = [false]; currency EntryFee(CurrencyCode) { uniteditable = [false]; }Example code - The property uniteditable is set to false in the client file
null
.currency EntryFee(CurrencyCode) { unitvisible = [EntryFee != null]; uniteditable = [false]; }
Example code - The property unitvisible is set to hide the unit
uniteditable = [IsNew];
list <list_name> { ... currency <data_item_name>(CurrencyitemRef) { ... } measure <data_item_name>(MeasureitemRef) { ... } }------ Example code ------- //Adding to a list list Currlist for AranlkTest { &DynamicComponentDependency ACCRUL currency Amount(Currency) { unitselector CurrSelector; unitlookup IsoCurrset(CurrencyCode); } } //Adding to a group group NewGroup for AranlkTest { &DynamicComponentDependency ACCRUL currency Amount(Currency) { unitselector CurrSelector; unitlookup IsoCurrset(CurrencyCode); } } //Adding to a card group NewCard for AranlkTest { &DynamicComponentDependency ACCRUL currency Amount(Currency) { unitselector CurrSelector; unitlookup IsoCurrset(CurrencyCode); } } //Adding to a selector selector CurrencySelector for AranlkTest { orderby = TestKey; label = "${TestKey} - ${TestName} "; static TestName { label = "Currency Name"; } &DynamicComponentDependency ACCRUL currency Amount(Currency) { unitselector CurrSelector; unitlookup IsoCurrset(CurrencyCode); } }
None.
Below is a list of properties that can be used to customize the control.
columnexclude | columnvisible | editable | format | label | preserveprecision | required | searchable | showlabel | size | uniteditable | unitexportlabel | unitlookup | unitrequired | unitselector | unitvisible | validate command | visible
Below is an example of a currency and a measure field.
Figure 4 - Currency/measure example (non-expanded)
Figure 5 - Currency/measure example (expanded)
------ Example code for currency/measure ------ -------------- Projection file ----------------
entityset IsoCurrencySet for IsoCurrency; entityset IsoUnitSet for IsoUnit;
----------------- Client file -----------------
//Code for Field measure MyMeasureValue(MyMeasureCode) { label = "My Measurement"; unitselector MyIsoUnitSelector; unitlookup IsoUnitSet(UnitCode); required = [true]; unitexportlabel = "Its my Measure Unit"; } currency MyCurrencyValue(MyCurrencyCode) { label = "My Currency"; unitselector MyIsoCurrencySelector; unitlookup IsoCurrencySet(CurrencyCode); unitexportlabel = "Its my Currency Unit"; } //Code for selectors selector MyIsoUnitSelector for IsoUnit { orderby = UnitCode; static UnitCode; } selector MyIsoCurrencySelector for IsoCurrency { orderby = CurrencyCode; static CurrencyCode; }