Skip to content

Currency/Measure

This document is still under construction. The completed version will be available in IFS Applications 10 Update 6.* *

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.

Currency/Measure

Figure 1 - Currency/Measure control with value and unit as one combination.

Currency/Measure

Figure 2 - Currency/Measure control (read-only mode).

Currency/Measure

Figure 3 - Currency/Measure control (edit mode).

Variations

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.

When to use

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 Cloud 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.

How to use

The steps below describes how to add a currency/measure client control to a page:

Defining the entity file

  1. Define the two attributes in the.entity file. One attribute for the value, and one for the unit.

attributes {  
   ...  
   public       EntryFee           NUMBER               A-IU-;  
   public       CurrencyCode       TEXT(3)/UPPERCASE    A-IU-;  
}  

Defining the projection file

  1. If necessary, define the entityset to use a lookup in the.projection file.

entityset IsoCurrencyEntitySet for IsoCurrency;  
entityset IsoUnitSet for IsoUnit;  

Defining the client file

  1. Define the currency code in the.client file.

currency EntryFee(CurrencyCode) {  
   unitlookup IsoCurrencyEntitySet(CurrencyCode);  
   unitselector IsoCurrencySelector;  
}  

selector IsoCurrencySelector for IsoCurrency {  
   static CurrencyCode;  
}  

Setting the appropriate properties to the currency/measure client control

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.

  1. Set the property to be not editable in the.projection file or in the.client file.

uniteditable = [false];  
currency EntryFee(CurrencyCode) {  
   uniteditable = [false];  
}  

*Example code - The property uniteditable is set to false in the client file*
  1. Hide the unit, for example if the value is null.

currency EntryFee(CurrencyCode) {  
   unitvisible = [EntryFee != null];  
   uniteditable = [false];  
}  

Example code - The property unitvisible is set to hide the unit

  1. Set the unit to only be editable during creation of a record.

uniteditable = [IsNew];  

Add Currency/Measure to a container

  1. Add the Currency/Measure control to the same places as for any other field (inside a Group, List, Selector, or Card.

list <list_name> {  
    ...  
    currency <data_item_name>(CurrencyitemRef) {  
        ...  
    }  
    measure <data_item_name>(MeasureitemRef) {  
       ...  
    }  
}  

Limitations

None.

Properties

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

Example

[Comment]: Is it possible to have a new example with screenshot here? Similar to Figure 1, but also with a complete code example. Perhaps an example that is not about currency?

Below is an example of how currency/measure is used to represent....

Screenshot of example here

Figure 4 - Currency/measure example


// Example code for currency/measure  
..