This article will help you understand:
- what conditional content is, and
- how and when to use conditional content in document templates.
What is conditional content, and why would you use conditional content in document templates?
As part of document automation, authors can create a document and make it available to their users as an email attachment or a downloadable link. However, with increasing complexity, document-generating modules become prone to errors, i.e., in function and/or style. Using conditional content in document templates can provide a remedy by allowing authors to show/hide complete sections of a template at their will, i.e., if a specific condition is met.
Automating complex documents becomes significantly easier by using conditional content:
- it will generally eliminate the need to use more than one template,
- it takes some of the complexity out of the module, and
- it preserves the integrity of custom styling and formatting.
How to use conditional content in document templates
In order to use conditional content in a module, you first need to prepare your document template by mapping in conditional placeholders. You might already be familiar with template placeholders. They work very similarly, and both types of placeholders are found in the Create Document Action.
|
![]() |
Follow the steps below to map conditional placeholders in your document template:
- Open your DOCX Template in Word.
- Map in conditional placeholders. Similar to template placeholders, conditional placeholders are also created by using two sets of curly brackets "{{ }}" and text. As conditional placeholders are supposed to mark the beginning and the end of a section, one conditional placeholder consists of two commands:
{{\if condition_name}}
Your Document Section
{{\endif condition_name}}
- Ideally, the condition name should correspond with the name of the Value Node in your module. That will aid you later in assigning placeholders with their matching values.
- โNote that the {{\if condition_name}} command needs to be placed in the line above the section of the document you would like to show or hide. Similarly, the {{\endif condition_name}} command needs to be placed below the section of the document you would like to show or hide.
Follow the steps below to add conditional content to your Module:
- Select the plus icon "+" on a Node towards the top of your module.
- Select New Value.
- In the attribute editor which opens, select Number.
- Double-click New value to name your Node. Ideally, this should match the "condition_name" in your template.
- In the number field, type in "0".
Think of this as setting up a light switch. When the light switch is in position "0", the light turns off. However, this does not mean that the electricity is gone. I.e., the section exists in the template but is hidden in the generated document.
Let us take a look at how to turn the light on or unhide the section:
- Select the plus icon "+" on a Node and select New Input to create a new Input Node.
- Create different options for the different conditional sections within your template.
- Select the plus icon "+" on a Node and select New Action and in the attribute editor select Empty. This Node is for maintenance only and does not serve any other purpose. Additionally, if you decide to group the following Nodes together, this Node will be displayed as the title.
- Again, select the "+" on a Node and select New Value, then select Number. Double-click New value and start typing out the name that you chose for the first conditional content section. A drop-down menu will appear with the option to RENAME or UPDATE the value. Select the option below UPDATE.
- In the number field, type in "1".
When the light switch is in position "1", the light turns on. I.e., the section is no longer hidden in the document. However, we are still missing the most essential part of conditional content: the condition.
- Select the plus icon "+" on a Node and select New Action and in the attribute editor select Empty. Again, this Node is for maintenance purposes, in case you need to make changes later on.
- Select the plus icon "+" on the empty Action Node above the updated Number Value Node and select New Transition. Then select the empty Action Node below the updated Number Value Node to create a transition.
- Select the Transition between the first empty Action Node and the updated Number Value Node, then select Add Condition.
- Select the first field and select the Input Node that contains all different content options. Then, select the second field and choose the Contains as the operator.
- Finally, select the last field and select the option corresponding to the updated Value Node.
Repeat the steps above for every additional clause. Then, it is time for the final steps:
- Select the plus icon "+" on a Node and select New Action, and in the attribute editor, select Create Document.
- Select the field Document template and select your custom template.
- You may choose to change the File Name or File extension.
- Below you will find the option to map in template placeholders and conditional placeholders. BRYTER will automatically identify all conditional placeholders. As auto-mapping is not yet available, select the field below each conditional placeholder and assign the corresponding value by either typing out the Node's name or selecting it from the drop-down menu.
- Finally, add a download link to the document in your Result Node using @-referencing or make it available to users via an e-mail attachment.
Note that any time you make changes to the template, you will need to re-upload an updated version to BRYTER.
โ Ensure that every conditional content section is encased by the following commands: Two sets of curly brackets "{{ }}", followed by a backslash "\" and "if" or "endif" as well as the condition_name. Otherwise, you may experience errors.
{{\if condition_name}}
Your Document Section
{{\endif condition_name}}
โNote that the {{\if condition_name}} command needs to be placed in the line above the section of the document you would like to show or hide. Similarly, the {{\endif condition_name}} command needs to be placed below the section of the document you would like to show or hide.
Make sure to also check the known limitations section of this article if you encounter any other problems.
Example use cases
Draft Contracts
Use conditional content to simplify drafting lengthy contracts containing several custom clauses. Conditional content allows authors to include all potentially relevant clauses in a contract, as complete sections can be easily hidden/unhidden based on end-user input.
Generate Reports
Use conditional content in document templates to generate reports that include standard sections and/or tables based on, e.g., a calculated risk score or other decision results based on end-user input.
Known limitations
- You might know about auto-mapping in the context of template placeholders. This feature is not implemented for conditional placeholders yet.
- This feature does not support nested conditions in templates yet and will display an error if attempted.
- The {{\if condition_name}} and {{\endif condition_name}} commands do not work when placed in the same line as the section of the document you would like to show or hide as they need to be placed in separate lines.