ifGreaterThanOrEqualTo
The ifGreaterThanOrEqualTo NSM predefined
function returns the string specified in onTrue if param1 is
greater than or equal to param2. Otherwise, the
function returns the string specified in onFalse.
Syntax
ifGreaterThanOrEqualTo(param1,param2,onTrue,onFalse)Parameters
- param1
- Specifies a number.
- param2
- Specifies a number.
- onTrue
- Specifies a string that is returned if param1 is greater than or equal to param2.
- onFalse
- Specifies a string that is returned if param1 is not greater than or not equal to param2.
Description
The ifGreaterThanOrEqualTo NSM
predefined function compares the strings specified in param1 and param2.
The function returns the string specified in onTrue if param1 is
greater than or equal to param2. Otherwise, the
function returns the string specified in onFalse.
Returns
This function returns the string specified in onTrue if param1 is greater than or equal to param2. Otherwise, the function returns the string specified in onFalse.Examples
ifGreaterThanOrEqualTo("45","45","true","false") returns "true"
ifGreaterThanOrEqualTo("45.5","45.0","y","n") returns "y"
ifGreaterThanOrEqualTo("6","7","yes","no") returns "no"
ifGreaterThanOrEqualTo("four","five","t","f") /* ERROR is thrown here*/The following descriptions explain how the ifGreaterThan function
operates on the parameters:
- In the first example, the
ifGreaterThanOrEqualToNSM predefined function compares the string specified in param1 ("45") with the string specified in param2 ("45"). Because the string specified in param1 is equal to the string specified in param2, theifGreaterThanOrEqualTofunction returns the string"true"that is specified in onTrue. - In the second example, the
ifGreaterThanOrEqualToNSM predefined function compares the string specified in param1 ("45.5") with the string specified in param2 ("45.0"). Because string specified in param1 is greater than the string specified in param2, theifGreaterThanOrEqualTofunction returns the string"y"that is specified in onTrue. - In the third example, the
ifGreaterThanOrEqualToNSM predefined function compares the string specified in param1 ("6") with the string specified in param2 ("7"). Because string specified in param1 is not greater than the string specified in param2, theifGreaterThanOrEqualTofunction returns"no"that is specified in onFalse. - In the fourth example, the
ifGreaterThanOrEqualToNSM predefined function compares the string specified in param1 ("four") with the string specified in param2 ("five"). The param1 and param2 parameters require numbers. Because the string value does not resolve to a number,ifGreaterThanOrEqualToreturns an error.
As can be seen in the examples, the ifGreaterThanOrEqualTo function
provides flexibility in specifying the strings to return in the onTrue and onFalse parameters.