TODECIMAL

Syntax

TODECIMAL (expression)

Description

Converts numeric or string data to a Decimal value.

Arguments

expression The number or string value to convert. expression can be:

— Boolean
— Byte
— Double (any)
— Integer (any)
— String
— Unsigned Integer (any)

Returns

A Decimal value.

Remarks

To do arithmetic or comparisons with a Decimal data type source field , use TODECIMAL to convert any other floating point operands, such as, Double(32), Double(64), or Floating-point constant. See the Arithmetic example below.

Trying to convert DateTime or String (1) data to Decimal results in an error.

Examples

Usage Example

To convert the source field CostPerUnit from String to Decimal where the value of the source field =32.50:

TODECIMAL (source.CostPerUnit)

Returns: 32.5

Arithmetic Example

If, for example, the source field MyEntity.HourlyWage is Decimal data and contains 15.25, the following formula:

(MyEntity.HourlyWage + 1.25)

Returns: Validation warning

The correct formula requires that you convert the operand, as follows:

( MyEntity.HourlyWage + TODECIMAL(1.25))

Returns: 16.50

Related Topics

Data Conversion