Include or exclude specific slides from your output dynamically using visibility conditions
You can select which slides from your template will be included in the presentation using a visibility condition. This can be especially helpful if you have a large number of slides in a master template and you want to show a subset of those slides to particular recipients of the presentation or report.
Let's walk through a simple example.
1. Add visibility conditions to your slide template
In your Google Slides or PowerPoint template, add a visibility condition to the speaker notes for any slide that you want to dynamically include or exclude. For example, below I have a slide that should only be included in the deck for enterprise-level clients.
In this example, if the value for {{tier}} is Enterprise, then this slide will be shown in the output.
2. Example visibility conditions
Text:
visible: {{pragma}} == 'value'
where the pragma is filled with a text string and the value is text enclosed in single quotes
Numeric:
visible: {{pragma}} > X
where the pragma is filled with a number and the value X is also a number
Composite statements:
visible: {{pragma}} == 'value' and {{pragma2}} > 1
You can also combine expressions using or, and, and other operators.
If the visibility condition evaluates to TRUE, then the slide will be included in the output. If it evaluates as FALSE, then the slide will not be shown.
3. Map the pragmas used in the visibility condition to data
As with any other pragma, you must either map the pragma used in the visibility condition to a data source or you can enter a value for it when you generate the slides. Visibility pragmas can also be used in Bulk Mode.
In the example above, I mapped the {{tier}} to a specific field in my Google Sheet data source.
4. Troubleshooting slide visibility in your output
Some common errors when setting visibility pragmas:
- Make sure the text of the pragma value and the string you enter as the matching value are exactly the same. Case and spaces matter. And be sure to use single quotes around the value.
- If comparing numbers, be sure that the value of the pragma is actually a number. If using bulk mode to set this pragma, make sure the format is set to either integer or float.
Tutorial walkthrough: