This article explains how to group elements in a document based on specific conditions so they can be visible, hidden, or deleted when generating the template.
Prerequisites
|
ImportantThe Group smart field is only available in Word. |
Often, when building smart documents some elements should be visible, hidden, or deleted based on specific conditions using IfElse statements, the Group smart field can be used for that purpose. Follow these steps to create Group smart field:
- In Template Designer, navigate to the Template tab.
- Select the elements that should be grouped together.
- Click + Add smart field.
This step doesn't apply if you are adding the very first smart field in the template. - Expand the section by clicking on More.
- Click on Group.
- Optionally edit the Display name.
The display name will be displayed in the Template tab once the smart field has been added. - Select the desired Visibility:
- Always show: the group will always be displayed without any conditions.
- Expression builder: the group will be displayed based on a (simple) condition using the Expression builder.
- Custom visibility: the group will be displayed based on a visibility expression (binding) that is typed.
- Specify the Visibility for the group.
The template contains a text form response field 'Your_reference'. The sentence regarding 'your reference' is selected and a Group smart field using the Expression builder is created. The Visibility condition is:
IF 'Form.Your_reference' 'Is empty' THEN 'Hide' ELSE 'Show'
- If the question is filled by the user, the reference group is visible in the document.
- If the question isn't filled by the user, the reference group is hidden in the document.
The template contains a checkbox form response field, called 'Include_references'. The text regarding the references is selected and and a Group smart field using a Custom visibility is created. The Visibility expression is:
{{IfElse(Form.Include_references, VisibilityType.Visible, VisibilityType.Hidden)}}
- If the checkbox is checked, the references group is visible in the document.
- If the checkbox isn't checked, the references group is hidden in the document.
- Optionally, perform an additional action on the smart field:
Allow updates: Allow the smart field to be updated after its generation when edited by the user through the Document content updater. This option will not be visible if the document content updater is not enabled on the smart template.
Important
Using
VisibilityType.Delete
will prevent the Allow updates option to work as it will delete the content control on document generation which will effectively disable the Document content updater for this group. - Click Add to template.
The smart field will be injected into the template and will be displayed in the Template tab.
Note
|
Comments
Article is closed for comments.