Dec – PB Docs 150

Dec DataWindow expression function

Description

Converts the value of a string to a decimal.

Syntax

Argument

Description

string

The string you want returned as a decimal

Return Values

Decimal. Returns the contents of string as
a decimal if it succeeds and 0 if string is
not a number.

Usage

The decimal datatype supports up to 28 digits.

You can also append the letter D in upper or lowercase to
identify a number as a decimal constant in DataWindow expressions. For example, 2.0d and 123.456789012345678901D are
treated as decimals.

Examples

This expression returns the string 24.3 as a decimal
datatype:

This expression for a computed field returns “Not
a valid score” if the string in the score column does not
contain a number. The expression checks whether the Dec function
returns 0, which means it failed to convert the value:

This expression returns 0:

This validation rule checks that the value in the
column the user entered is greater than 1999.99:

This validation rule for the column named score insures
that score contains a string:

See Also

  • Dec in the PowerScript
    Reference


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x