About this article
This article explains what the Equals() operator is and provide examples of how it can be used with the binding syntax in smart templates.
Prerequisites
|
What is the Equals() operator?
Equals() is an operator that returns True/False depending on if two values are equal or not. Equals() is case sensitive, comparisons between two values that might be using different casings can be achieved by utilizing a Lower() or Upper() functions together with Equals.
Equals() logic
Syntax | {{Equals(Value1, Value2)}} |
Output | True/False |
Equals() operator examples
Example 1
Using the Equals() operator to check if two values are equal.
Binding | {{Equals("this is text", "this is text")}} |
Output | True |
Binding | {{Equals("this is text", "this is another text")}} |
Output | False |
Example 2
Using the Equals() operator together with Lower() to match the casing used and make a comparison.
Binding | {{Equals(Lower("this is text"), Lower("THIS IS TEXT"))}} |
Output | True |
Example 3
Using the Equals() operator together with Not() and Lower() to match the casing used and make a comparison.
Binding | {{Not(Equals(Lower("this is text"), Lower("THIS IS TEXT")))}} |
Output | False |
Example 4
Using the Equals() operator together with IfElse() and Lower() to match the casing used in the "RecipientA" and the "RecipientB" questions originating from the response form and make a comparison. If the values are equal, the output should be "Send to the recipient listed above", otherwise the value for "RecipientB" should be shown.
Binding | {{IfElse(Equals(Lower(Form.RecipientA), Lower(Form.RecipientB)), "Send to the recipient listed above", Form.RecipientB)}} | |
Input | Form.RecipientA = "John Smith"
Form.RecipientB = "john smith" |
Form.RecipientA = "John Smith"
Form.RecipientB = "John Doe" |
Condition |
True |
False |
Output | "Send to the recipient listed above" | "John Doe" |
Related articles
Comments
Article is closed for comments.