Integer

Description

Converts the value of a string to an integer.

Syntax

Integer ( string )

Argument

Description

string

The string you want returned as an integer


Return value

Integer. Returns the contents of string as an integer if it succeeds and 0 if string is not a number.

Examples

This expression converts the string 24 to an integer:

Integer("24")

This expression for a computed field returns "Not a valid age" if age does not contain a number. The expression checks whether the Integer function returns 0, which means it failed to convert the value:

If (Integer(age) <> 0, age, "Not a valid age")

This expression returns 0:

Integer("3ABC")  // 3ABC is not a number

This validation rule checks that the value in the column the user entered is less than 100:

Integer(GetText()) < 100

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

Integer(age) <> 0

See also

IsNumber

Integer in the section called “Integer” in PowerScript Reference