Articles in this section

How to use the And() and Or() operators with multiple True/False arguments

This article explains what the And() or Or() operators are and provide examples of how they can be used with the binding syntax in smart templates.  

  Prerequisites

  • Library and at least one Dynamics module enabled.
  • Templafy Desktop and Office VSTO add-in installed.
  • Space owner access to the Templafy tenant.

  Important

These functions support True/False statements as arguments and cannot use string values as arguments.

What is the And() operator?

And() is an operator that takes many True/False statements as arguments and returns True when all the arguments are True, and returns False if at least one of the arguments is False.

And() logic

Syntax {{And(True/False, True/False, True/False, ...)}}
Output True/False

And() operator examples

Example 1

Using the And() operator together with IfElse() to set the visibility of a smart field based on the value of three checkbox questions originating from the response form.

Binding {{IfElse(And(Form.Checkbox1, Form.Checkbox2, Form.Checkbox3), VisibilityType.Visible, VisibilityType.Hidden)}}
Input Form.Checkbox1 = "☑"
Form.Checkbox2 = "☑"
Form.Checkbox3 = "☑"
Form.Checkbox1 = "☐"
Form.Checkbox2 = "☑"
Form.Checkbox3 = "☑"
Condition True False
Output Visible text Hidden text

Example 2

Using the And() operator together with IfElse()and Equals() to set the visibility of a smart field based on the value of three text questions originating from the response form.

Binding {{IfElse(And(Equals(Form.Question1, ""), Equals(Form.Question2, ""), Equals(Form.Question3, "")), VisibilityType.Hidden, VisibilityType.Visible)}}
Input Form.Question1 = ""
Form.Question2 = ""
Form.Question3 = ""
Form.Question1 = ""
Form.Question2 = "Hello world"
Form.Question3 = ""
Condition True False
Output Hidden text Visible text

What is the Or() operator?

Or() is an operator that takes many True/False statements as arguments and returns True when at least one of the arguments is True, and returns False if all the arguments are False.

Or() logic

Syntax {{Or(True/False, True/False, True/False, ...)}}
Output True/False

Or() operator examples

Example 1

Using the Or() operator together with IfElse()to set the visibility of a smart field based on the value of three checkbox questions originating from the response form.

Binding {{IfElse(Or(Form.Checkbox1, Form.Checkbox2, Form.Checkbox3), VisibilityType.Visible, VisibilityType.Hidden)}}
Input Form.Checkbox1 = "☑"
Form.Checkbox2 = "☑"
Form.Checkbox3 = "☑"
Form.Checkbox1 = "☐"
Form.Checkbox2 = "☑"
Form.Checkbox3 = "☑"
Form.Checkbox1 = "☐"
Form.Checkbox2 = "☐"
Form.Checkbox3 = "☐"
Condition True True False
Output Visible text Visible text Hidden text

Example 2

Using the Or() operator together with IfElse() and Equals() to set the visibility of a smart field based on the value of three text questions originating from the response form.

Binding {{IfElse(Or(Equals(Form.Question1, ""), Equals(Form.Question2, ""), Equals(Form.Question3, "")), VisibilityType.Hidden, VisibilityType.Visible)}}
Input Form.Question1 = ""
Form.Question2 = ""
Form.Question3 = ""
Form.Question1 = ""
Form.Question2 = "B"
Form.Question3 = ""
Form.Question1 = "A"
Form.Question2 = "B"
Form.Question3 = "C"
Condition True True False
Output Hidden text Hidden text Visible text
switch slide insertion smart fields custom text binding show space space sensitivity label subtract tech_role
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.