class sap.ui.unified.Currency

Control sample: sap.ui.unified.Currency
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/unified/Currency
Application Component: CA-UI5-CTR

A text view which displays currency values and aligns them at the decimal point.

Overview

The currency control consists of an amount, which is formatted automatically according to the user’s locale (using delimiter symbols for the decimal point and thousand separators) and to the currency set for this specific number (number of decimal places).

The currency is expressed as a three-letter code.

Usage

When to use

When not to use

Responsive behavior

The control supports amounts smaller than 100 trillion, which still fit on a phone screen in portrait mode. For larger amounts, the unit of measurement wraps to the next line, which makes it difficult to compare the amounts.

This control can be a drag source.

Constructor

Constructor for a new Currency.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.unified.Currency(sId?, mSettings?)
Param Type Default Value Description
sId? string

ID for the new control, generated automatically if no ID is given

mSettings? object

Initial settings for the new control


Properties

Name Type Default Value Description
currency string

Determines the displayed currency code (ISO 4217).

Note: If a * character is set instead of currency code, only the character itself will be rendered, ignoring the value property.

Visibility: public
emptyIndicatorMode sap.m.EmptyIndicatorMode Off

Specifies if an empty indicator should be displayed when there is no text.

Since: 1.89.

Visibility: public
maxPrecision int

Defines the space that is available for the precision of the various currencies.

Visibility: public
stringValue string

Determines the currency value as a string.

String value is useful if you want to store really big values. If there are more than 21 digits before the decimal point or if the number starts with “0.” followed by more than five zeros, it is represented in exponential form. In these cases use the stringValue property to keep the number in decimal format.

Note: If set, it will take precedence over the value property.

Since: 1.54.

Visibility: public
useSymbol boolean true

Displays the currency symbol instead of the ISO currency code.

Visibility: public
value float 0

Determines the currency value.

Visibility: public

Methods Overview

Method Description
sap.ui.unified.Currency.extend

Creates a new subclass of class sap.ui.unified.Currency with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

getAccessibilityInfo

References:

  • sap.ui.core.Control#getAccessibilityInfo

getCurrency

Gets current value of property currency.

Determines the displayed currency code (ISO 4217).

Note: If a * character is set instead of currency code, only the character itself will be rendered, ignoring the value property.

getCurrencySymbol

Get symbol of the currency, if available.

getEmptyIndicatorMode

Gets current value of property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no text.

Default value is Off.

getFormattedValue

The formatted value.

getMaxPrecision

Gets current value of property maxPrecision.

Defines the space that is available for the precision of the various currencies.

sap.ui.unified.Currency.getMetadata

Returns a metadata object for class sap.ui.unified.Currency.

getStringValue

Gets current value of property stringValue.

Determines the currency value as a string.

String value is useful if you want to store really big values. If there are more than 21 digits before the decimal point or if the number starts with “0.” followed by more than five zeros, it is represented in exponential form. In these cases use the stringValue property to keep the number in decimal format.

Note: If set, it will take precedence over the value property.

getUseSymbol

Gets current value of property useSymbol.

Displays the currency symbol instead of the ISO currency code.

Default value is true.

getValue

Gets current value of property value.

Determines the currency value.

Default value is 0.

init

Initializes the control.

setEmptyIndicatorMode

Sets a new value for property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no text.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Off.

setStringValue

Sets a new value for property stringValue.

Determines the currency value as a string.

String value is useful if you want to store really big values. If there are more than 21 digits before the decimal point or if the number starts with “0.” followed by more than five zeros, it is represented in exponential form. In these cases use the stringValue property to keep the number in decimal format.

Note: If set, it will take precedence over the value property.

When called with a value of null or undefined, the default value of the property will be restored.

sap.ui.unified.Currency.extend

Creates a new subclass of class sap.ui.unified.Currency with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

getAccessibilityInfo

References:

getCurrency

Gets current value of property currency.

Determines the displayed currency code (ISO 4217).

Note: If a * character is set instead of currency code, only the character itself will be rendered, ignoring the value property.

getCurrencySymbol

Get symbol of the currency, if available.

getEmptyIndicatorMode

Gets current value of property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no text.

Default value is Off.

getFormattedValue

The formatted value.

getMaxPrecision

Gets current value of property maxPrecision.

Defines the space that is available for the precision of the various currencies.

sap.ui.unified.Currency.getMetadata

Returns a metadata object for class sap.ui.unified.Currency.

getStringValue

Gets current value of property stringValue.

Determines the currency value as a string.

String value is useful if you want to store really big values. If there are more than 21 digits before the decimal point or if the number starts with “0.” followed by more than five zeros, it is represented in exponential form. In these cases use the stringValue property to keep the number in decimal format.

Note: If set, it will take precedence over the value property.

getUseSymbol

Gets current value of property useSymbol.

Displays the currency symbol instead of the ISO currency code.

Default value is true.

getValue

Gets current value of property value.

Determines the currency value.

Default value is 0.

init

Initializes the control.

setEmptyIndicatorMode

Sets a new value for property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no text.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Off.

Param Type DefaultValue Description
sEmptyIndicatorMode sap.m.EmptyIndicatorMode Off

New value for property emptyIndicatorMode

setStringValue

Sets a new value for property stringValue.

Determines the currency value as a string.

String value is useful if you want to store really big values. If there are more than 21 digits before the decimal point or if the number starts with “0.” followed by more than five zeros, it is represented in exponential form. In these cases use the stringValue property to keep the number in decimal format.

Note: If set, it will take precedence over the value property.

When called with a value of null or undefined, the default value of the property will be restored.

Param Type DefaultValue Description
sStringValue string

New value for property stringValue