CX_SYSTEM_OBJECT::UnitPrecision
Description:
This function returns the(national) usual number of decimal places of a given unit. For this purpose the unit must be passed as text and the unit range as flag. E.g. 'DM' can be understood as a unit of length for 'decimeter' on the one hand and as a currency unit 'Deutsche Mark' on the other hand.
If you want to check in all unit ranges, you have to specify UF_ALL_UNITS as flag.
Note: The national number of decimal places represents the usual number of decimal places for a given unit. When currency units are used, monetary amounts in normal(national) use are usually given with two decimal places (e.g. DM 10.89). However, when currency rates are quoted, a higher number of decimal places is often used, e.g. "1 USD = 1.6279 DM". This number of internationally common decimal places can be queried using the function RateTablePrecision . For non-currency units, the number of national and international decimal places is the same.
Code example:
In dem Beispiel-Programm wird die Anzahl an Nachkommastellen für die Einheit "DM" ermittelt. Dabei wird die Einheit in den Bereichen "Längen", "Gewichte" und "Währungen" gesucht. Dazu werden die Flags für die einzelnen Bereiche mit "+" zu einem Suchbereich zusammengefasst.
"DM" UF_LENGTH UF_WEIGHTS + UF_CURRENCY + SYSTEM Call(UnitPrecision)
Stack | Position | Object type | Brief description |
---|---|---|---|
Stack(In) | Top | INTEGER | the area in which the unit is to be searched |
Top 1 | STRING | the name of the unit | |
Stack(Out) | Top | INTEGER | the number of decimal places |