Dec – PB Docs 2017

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 value

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 section called “Dec” in PowerScript Reference 

Decimal support in
DataWindow expressions


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