Troubleshooting Number property UI control issues
When specifying a Text control of type Number for the fields of your application’s web form, you see errors indicating that you have entered invalid values for integers, decimal places, or currency. You might also see unexpected formats for integer, decimal place, or currency values.
<value> is not a valid integer value
<value> is not a valid decimal place
<value> is not a valid currency value
Many issues with Number controls (integers, decimals, currency) are the result of misunderstanding how to correctly specify Number controls in the fields of your application.
Text controls that you specify as Type = Number can be any numeric property:
You can also adjust Text controls that are Numbers using the following Format options:
- Text alignment
- Decimal places
- Negative format
To prevent or correct invalid Number values and Number formatting problems, follow these suggested approaches when specifying Text controls for Numbers in your application forms.
Upgrade to the latest Pega Platform Release, including the Pega Platform Patch Release and refer to the product documentation for Pega 8.3 and later releases that is published in the Pega Community.
Values are assigned to the Integer property in one of the following ways:
- Through Integer control in the application’s user interface, the user enters the Input values based on how the presentation of the Integer control is designed. See Integers properties - Presentation tab.
With this design option, if application users try to enter a decimal value for the integer, Pega displays an error message like this example: 14500.23 is not a valid integer value.
The following figure shows an example of an invalid integer value entered in the IntegerProp field.
- As an application developer, you can assign a value to the Integer property using a data transform.
With this design option, you can intentionally assign a decimal value to the Integer property and Pega stores its value by rounding up to the nearest positive integer value, as shown in the following examples of decimal value rounding:
123.6 rounds up to 124
123.5 rounds up to 124
123.4 rounds down to 123
The following figure shows how to set a data transform for the target .integerProp equal to source value 123.6.
The following figure shows the results of the data transform that set the integer value., rounding the value up to 124.
For a Decimal value mode or a Double value mode, you can specify any decimal value.
For more information on Decimal and Double value modes, see Property form: Creating the General tab – Value modes.
Decimal and grouping separators for a numeric control are based on the operator locale.
For Number, Currency, and Decimal controls, the markup is generated as <input type=”number”/> . This markup does not allow users to enter a decimal comma (,) in Chrome and Firefox browsers. Therefore, separators will not be displayed in these browsers.
To specify how separators are displayed, on the Presentation tab of the Number control, select the check box Display value using read-only formatting. When you check this check box, markup is generated <input type=”text”/>.
For more information, see Integer Properties — Presentation tab, the field Display Read-only formatting.
Refer to the Pega 8.3 Help topics about specifying Currency values in your applications:
The following sections provide additional information that clarifies and expands upon the Help topic Currency properties - Presentation tab
Remember that the Symbol display for a given Currency Code depends on the operator’s locale.
The Read-only option for the Currency Symbol is determined by Currency, Constant, or Reference.
When the Currency Symbol is determined by Currency, you can choose one of the following options:
- Local Currency whereby the Currency Symbol is displayed according to locale settings of the operator.
- Other Currency whereby the client can enter another currency from a list of supported currency codes. Refer to Currency Codes and ISO Currency Code List.
The Currency Symbol can also be a Property reference. If Other Currency is not listed on the ISO site, Pega displays a Number with the default currency symbol, which is the US dollar sign ($).
When the Currency Symbol is determined by Constant or Reference, you can choose one of the following options:
- Constant can be any constant. The Constant symbol is Prepended to the Property value.
- Reference accepts any Property reference and prepends its value to the Property value.
The Currency Position determines the position of the Currency Symbol based on the default locale of the operator. You can override the default by specifying left or right of the number. For example: USD $1.00 or $1.00 USD.
When you specify Display currency as, you choose to display the currency name, the 3-character code, or the currency symbol.
Be careful to choose a currency display option that synchronizes with your other Currency presentation choices. Here is an example of unexpected display behavior.
If you choose to display the Currency Symbol, but you have specified Currency Symbol as Other Currency and specified a Currency Code that is not the default code of the operator’s locale, the system cannot interpret these mismatched values. Consequently, the system disregards Display currency as Currency Symbol and, instead, appends the Other Currency code to the currency value.
For example, the Operator Locale is en_IN, the Currency Symbol is Other Currency, the Currency Code is USD, and Display currency as is Currency Symbol.
With these Currency specifications, an expectation that a Currency value might display as $1234.76 is wrong because there is no way to distinguish whether the dollars are Singapore, Canadian, or United States dollars. The Currency value displays as 1234.76 USD. This value clearly indicates the currency as US dollars.
You can check the difference by specifying Currency Code as GBP (Pound Sterling) as Other Currency and use the Operator Locale of en_US to display GBP only. If you set the Operator Locale to en_GB, then the Currency values display as Pound Sterling, £.
You can specify the Rounding Method for Currency values:
- Round to nearest even number — If whole number is even, round down; if whole number is odd, round up. (Commonly referred to as banker's rounding.) For example, 11.5 = 12, 12.5=12.
- Round up to nearest — Always round up. For example, 11.5 = 12, 12.5 = 13.
For more information on the different rounding methods, refer to API specification for the Java™ Platform, Standard Edition 7, Enum RoundingMode. See the Enum Constant Summary for descriptions of the following Enum Constants: