Variables for reusable dynamic documents
Define variables such as Collaborator, Area or Date on a dynamic document and bind query block filters to them, so one layout renders for whatever the reader picks.
A variable is an input on a document. Instead of building a day sheet for every collaborator, you add a Collaborator variable, bind the query blocks' filters to it, and the document shows whichever collaborator the reader picks.
Adding a Variable
Open Variables
Add one
Set it up
Give it a Name the reader will see, such as "Collaborator" or "Show Date", choose its Type, and set Allow multiple values, Required and a Default value as needed.
Variable Types
| Type | The reader picks |
|---|---|
| Collaborator | A collaborator on the event |
| Area | An area on the event |
| Activity | An activity on the event |
| Crew | A crew member on the event |
| ResourceType | A resource type |
| Date | A date |
| Text | Free text |
With Allow multiple values, the reader can pick several, for example every area a department head looks after. A filter bound to a multi-value variable with is matches any of the picked values, and with is not excludes all of them.
Binding a Filter
In a query block filter, click the pin in the value field and choose Use variable, then the variable. From then on the filter uses whatever the reader has picked.
Picking Values
In the editor and on public links, a document with variables shows a Variables bar at the top. Readers pick a value for each one, and every block bound to it reloads. Documents opened from a collaborator's Dynamic Docs tab have no bar and use each variable's default value, so set defaults on documents you share that way.
What happens before a value is picked depends on the variable:
- With a Default value, the document opens already showing that value.
- A Required variable with no value and no default leaves the blocks that use it empty, and an error message names the missing variable, until a value is picked.
- An optional variable with no value is ignored: filters bound to it are skipped, so the blocks show all their rows.
Set a default on required variables so the document opens on the most common case. Deleting a variable leaves its filters in place but skips them.