Devonian Times Masthead

The DEVONtechnologies Blog

How to Use Placeholders

January 12, 2021 — Jim Neumann
Placeholders used in a template

In DEVONthink, placeholders are specialized strings that resolve specific values on demand. They can be used to dynamically add data to documents generated via templates. For example the Data > New from Template > Productivity > Phone Note template automatically inserts the date and time. They can also be used to do things like file items in locations based on dates. Here are some ways placeholders are used.

Control-click in an eligible text area, e.g., the text of a rich text document you’re using to create a template, and you’ll see the Insert Placeholder menu item. The submenus of this command have many options for a variety of operations, including things like today’s date or the User & Computer > Predefined Author, taking its value from the Author set in Preferences > Editing. When used, the placeholder is replaced by the detected value.

Note the placeholder has to be dealing with concrete data. For example, if you create a template and use a Tags placeholder, that placeholder will not be resolved as the newly created document has no tags. If you use a Current Date placeholder, that will resolve to today’s date as that is a globally known value, applicable to a new document or an existing item. So you must consider if you’re using the placeholder with a template or an existing item.

When used in text, you will see a percent-surrounded raw value, like %shortDate%. As you become familiar with these values, you can type them manually in text contents. When used in edit fields like those found in smart rules, you’ll see the placeholder name as a token similar to tags.

Placeholders are used in a few key places:

  • In templates, placeholders can be added to automatically populate data when you create new documents from the template.
  • In the template definition in Preferences > WikiLinks you can add placeholders to customize the appearance of newly created Wiki documents.
  • In a custom annotation template, used in the Annotations section of the Reminders & Annotations inspector, add placeholders to create an annotation to your liking.
  • In Tools > Batch Process, placeholders may be used to do things like add today’s date to the names of selected items.
  • In smart rules, you can do operations similar to batch processing.
  • In the Pro and Server editions, placeholders can be used when defining custom imprints in Preferences > Imprinter.

While placeholders can’t be used to extract partial values, e.g., “The first alias of the item” on an item with multiple aliases, they can still be very useful in a variety of situations.

For a list of available placeholders, see the Appendix > Placeholders section of the built-in help and its downloadable siblings.