About this article
This article explains what the GreaterThan(), LessThan() and Equals() functions are that you can use with number values and provide examples of how they can be used with the binding syntax in smart templates.
Prerequisites
|
What is the GreaterThan() function?
The GreaterThan() function can be used in combination with the IfElse() function and returns output based on the condition if the number value entered is greater than the number used in the expression.
GreaterThan() logic
Syntax | {{IfElse(GreaterThan(Condition), TrueValue, FalseValue)}} |
Input | Condition |
Output | TrueValue/FalseValue |
Example
Using the GreaterThan() function together with the IfElse() function. Depending on the value entered the output is 'Value is greater than 10' or 'Value is 10 or less':
Binding | {{IfElse(GreaterThan(Form.Number, 10), "Value is greater than 10", "Value is 10 or less")}} | ||
Input |
Form.Number = "5" |
Form.Number = "10" |
Form.Number = "15" |
Condition | False | False | True |
Output | "Value is 10 or less" | "Value is 10 or less" | "Value is greater than 10" |
|
What is the LessThan() function?
The LessThan() function can be used in combination with the IfElse() function and returns output based on the condition if the number value entered is less than the number used in the expression.
LessThan() logic
Syntax | {{IfElse(LessThan(Condition), TrueValue, FalseValue)}} |
Input | Condition |
Output | TrueValue/FalseValue |
Example 1
Using the LessThan() function together with the IfElse() function. Depending on the value entered the output is 'Value is less than 10' or 'Value is 10 or greater':
Binding | {{IfElse(LessThan(Form.Number, 10), "Value is less than 10", "Value is 10 or greater")}} | ||
Input |
Form.Number = "5" |
Form.Number = "10" |
Form.Number = "15" |
Condition | True | False | False |
Output | "Value is less than 10" | "Value is 10 or greater" | "Value is 10 or greater" |
|
Example 2
Using the LessThan() and GreaterThan() function together with the IfElse() and And() function. Depending on the value entered the visibility (e.g. of text/image) is set to visible or hidden:
Binding | {{IfElse(And(GreaterThan(Form.Number, 10), LessThan(Form.Number, 20)), VisibilityType.Visible, VisibilityType.Hidden)}} | ||
Input |
Form.Number = "10" |
Form.Number = "15" |
Form.Number = "20" |
Condition | False | True | False |
Output | Hidden text/image | Visible text/image | Hidden text/image |
What is the Equals() function?
The Equals() function can be used in combination with the IfElse() function and returns output based on the condition if the number value entered is equal to the number used in the expression.
Equals() logic
Syntax | {{IfElse(Equals(Condition), TrueValue, FalseValue)}} |
Input | Condition |
Output | TrueValue/FalseValue |
Example
Using the Equals() function together with the IfElse() function. Depending on the value entered the output is 'Perfect score' or 'Please try again':
Binding | {{IfElse(Equals(Form.Number, 10), "Perfect score", "Please try again")}} | ||
Input |
Form.Number = "5" |
Form.Number = "10" |
Form.Number = "15" |
Condition | False | True | False |
Output | "Please try again" | "Perfect score" | "Please try again" |
|
Related articles
Comments
Article is closed for comments.