VALUE( ) function

Converts a character string to a numeric value.

Syntax

VALUE(string, decimals)

Parameters

string

Character. A valid character expression or field.

decimals

Numeric constant. The number of decimal places to include in the output.

Output

Numeric.

Remarks

This function converts character data to numeric data. You can use the VALUE( ) function if you need to convert character expressions or field values to a numeric values for use in ACL commands.

VALUE( ) accepts numbers in any format. You can use any numeric formatting accepted by the Print data type such as punctuation, leading or trailing signs, and parentheses as input.

The VALUE( ) function can interpret different indicators of negative values such as parentheses and the minus sign. It can also interpret CR (credit) and DR (debit). For example, VALUE("1000CR", 2) returns -1000.00.

If the string parameter does not include decimals, ACL treats the number as an integer. For example, in converting (“123”, 2) when you specify two decimal places, ACL interprets “123” as 123.00. If the number of decimals specified in decimals is less than the number in the field or expression, the result is rounded. For example, the output for VALUE("10.56", 1) is “10.6”.

The VALUE( ) function is the opposite of the STRING( ) function, which converts numeric data to character data.

Examples

Example Return value

VALUE("123.4-", 3)

-123.400

VALUE("$123,456", 2)

123456.00

VALUE("77.45CR", 2)

-77.45

VALUE(" (123,456.78)", 0)

-123457

Related reference
STRING( ) function


(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback