Dec

Description

Converts a string to a decimal number or obtains a decimal value stored in a blob.

Syntax

Dec ( stringorblob )

Argument

Description

stringorblob

A string whose value you want returned as a decimal value or a blob in which the first value is the decimal you want. The rest of the contents of the blob is ignored. Stringorblob can also be an Any variable containing a string or blob.

Returns

Decimal. Returns the value of stringorblob as a decimal. If stringorblob is not a valid PowerScript number or if it contains an incompatible datatype, Dec returns 0. If stringorblob is null, Dec returns null.

Examples

Example 1

This statement returns 24.3 as a decimal datatype:

Dec("24.3")

Example 2

This statement returns the contents of the SingleLineEdit sle_salary as a decimal number:

Dec(sle_salary.Text)

Example 3

For an example of assigning and extracting values from a blob, see Real.

See also