This article explains how to adjust the visibility of smart fields based on specific conditions so they can be visible, hidden or deleted when generating the document.
Prerequisites
|
ImportantPlease note that the Template tab is only available in Word and PowerPoint. Inserting information into a Spreadsheet for Excel can be done through the Header Footer in the Advanced tab. |
Often, when building smart templates some elements might require to be visible, hidden, or deleted based on specific conditions. The Visibility option on the smart field level can be used for that purpose and requires the use of the binding syntax. Follow the steps below to a add a visibility expression:
Create a visibility binding with the Expression builder
- Create the necessary smart field.
- Open the Advanced section.
- Select Expression builder in the Visibility dropdown.
- Create the desired Visibility condition by adding values to the IF, THEN and ELSE fields:
In the 'Write a string or binding here' IF field you can type a binding likeForm.Title
or{{Form.Title}}
(if you type curly brackets they will be removed when the field is saved), or you can type a string like "Introduction". Include the double quotes in case of a string.
Important
- Field of type Checkbox is not supported in the Expression builder.
- The Expression builder can be used to quickly create a simple binding. After the binding is created you (optionally) can switch the view to Custom visibility and manually create a more advanced binding by modifying the binding that is shown in the Visibility expression field.
Create a visibility binding manually with Custom visibility
- Create the necessary smart field.
- Open the Advanced section.
- Select Expression builder in the Visibility dropdown.
- Type in the desired binding in the Visibility expression to adjust the smart field visibility.
Important
|
Visibility expression examples
Show or hide the smart field based on the value of a checkbox in the response form
Using the IfElse() function with Checkbox to determine visibility of a binding based on the value of 'Form.Introduction'. Binding:
{{IfElse(Form.Introduction, VisibilityType.Visible,VisibilityType.Hidden)}}
Example 1 | Example 2 | |
---|---|---|
Input | Checkbox is checked | Checkbox is not checked |
Condition | True | False |
Output | VisibilityType.Visible | VisibilityType.Hidden |
Show or hide the smart field based on the value of a question in the response form
Using the IfElse() function to set visibility of a binding based on the value of 'Form.Subject'. Binding:
{{IfElse(Equals(Form.Subject, "Introduction"), VisibilityType.Visible, VisibilityType.Hidden)}}
Example 1 | Example 2 | |
---|---|---|
Input | Form.Subject = "Introduction" | Form.Subject = "Product" |
Condition | True | False |
Output | VisibilityType.Visible | VisibilityType.Hidden |
Show or delete the smart field based on the value of a dropdown question in the response form
Using the IfElse() function to set visibility of a binding based on a Dropdown. Binding:
{{IfElse(Equals(Form.Confidentiality.Name, "Public"), VisibilityType.Visible, VisibilityType.Delete)}}
Example 1 | Example 2 | |
---|---|---|
Input | Form.Confidentiality.Name = "Public" | Form.Confidentiality.Name = "Confidential" |
Condition | True | False |
Output | VisibilityType.Visible | VisibilityType.Delete |
Show or hide the smart field based on the value of a dropdown question originating from the user profile
Using the IfElse() function together with Contains() to display or hide some text based on the value of the 'Office.Name' originating from the User Profile. If the 'Office.Name' is "Copenhagen" or "Berlin", the text should be hidden. If the 'Office.Name' is anything else, the text should be shown. Binding:
{{IfElse(Contains("Copenhagen, Berlin", UserProfile.Office.Name), VisibilityType.Hidden, VisibilityType.Visible)}}
Example 1 | Example 2 | Example 3 | |
---|---|---|---|
Input | UserProfile.Office. Name = "Berlin" |
UserProfile.Office. Name = "Copenhagen" |
UserProfile.Office. Name = "Eindhoven" |
Condition | True | True | False |
Output | VisibilityType.Hidden | VisibilityType.Hidden | VisibilityType.Visible |
Comments
Article is closed for comments.