Converts the value of a string to an integer.
Integer ( string )
Argument |
Description |
---|---|
string |
The string you want returned as an integer |
Integer. Returns the contents of string as an integer if it succeeds and 0 if string is not a number.
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
Integer in the PowerScript Reference