Templates
A template is the simplest kind of auto-calculated field. You write a sentence with the field values you want filled in, and the system substitutes them at display time.
A few examples:
{first_name} {last_name}→ “Catelyn Stark”Level {level} {class}→ “Level 7 Wizard”{title} {first_name} {last_name} of {homeland}→ “Lord Eddard Stark of Winterfell”{quantity}× {item_name} ({price} GP)→ “3× Healing Potion (50 GP)”
Templates are the right tool when you’re stitching values into a string and want the result to read naturally. For maths or conditional logic, reach for a Formula instead.
Writing a template
Section titled “Writing a template”The template is just a string with placeholders in curly braces. Anywhere you write {field_id}, the system swaps in the value of that field on this entity.
{first_name} {last_name}You can mix placeholders with literal text:
Level {level} {class} from {homeland}You can use a placeholder more than once:
{name}'s blade, named after {name}'s motherYou can even use placeholders for nested values when a field has structure:
{address.city}, {address.country}(The address field needs to have those nested keys for this to work — most fields don’t, so this is an unusual case.)
Setting up a template
Section titled “Setting up a template”- Add the field that’ll hold the result. Always text — even if the values inside are numbers, the output is text.
- Open Management → Entity Types, pick the type, switch to Behaviours, click Add Behaviour.
- Choose Auto-calculate, target the field you just made.
- Pick Template as the calculation kind.
- Type the template string into the box, or use the field-insertion picker on the right to insert
{field_id}at the cursor. - Watch the live preview underneath — it shows what the template will look like with sample data.
- Save.
What you can put in a placeholder
Section titled “What you can put in a placeholder”Any field on this entity, by its identifier (the short, lowercase name shown next to the field in the schema editor).
| Field type | What appears in the result |
|---|---|
| Short / long / rich text | The text value as-is. (Rich text formatting is stripped.) |
| Number | The number formatted as a string. |
| Date | The date in the format used by your world’s calendar. |
| Yes/no | ”true” or “false” — usually wrap with conditional logic in a formula instead. |
| Single choice | The selected option’s label. |
| Multiple choice | A comma-separated list of selected labels. |
| Entity link | The linked entity’s name. |
| Image / audio / file | The filename or URL. |
What happens with empty fields
Section titled “What happens with empty fields”If a placeholder references a field with no value, it becomes an empty string. So {first_name} {last_name} with last_name empty would render as “Catelyn ” with a trailing space.
This is mostly an issue for templates that mix multiple optional fields. A few patterns to handle it:
- Accept the trailing space — usually invisible at the end of a line.
- Use a Formula with
coalesce—coalesce(nickname, first_name, ""). - Add a visibility rule — only show the calculated field when the inputs are filled in.
Validation
Section titled “Validation”The editor checks every placeholder against your fields when you save. A few things it catches:
| Problem | What you’ll see |
|---|---|
{nonexistent} — field doesn’t exist on this type | Save is blocked with a clear error listing the unknown placeholders. |
Typo: {firs_name} instead of {first_name} | Same — caught at save time, not at display time. |
{has-dash} or {has space} — placeholders with non-identifier characters | Treated as literal text, not a placeholder. The runtime ignores them. |
If your template references a field that gets renamed or deleted later, the placeholder stays in the template but resolves to empty at display time. The Behaviours editor will flag it the next time you open that behaviour.
Worked examples
Section titled “Worked examples”Full name with title
Section titled “Full name with title”{title} {first_name} {last_name}When title is “Lord”, first_name is “Eddard”, last_name is “Stark”:
→ “Lord Eddard Stark”
When title is empty:
→ ” Eddard Stark” (with a leading space)
If the leading space bothers you, this is where a Formula starts to look better:
concat(coalesce(title, ""), if(is_null(title), "", " "), first_name, " ", last_name)Item display
Section titled “Item display”For an Item type with quantity, name, and value fields:
{quantity}× {name} ({value} GP)→ “3× Healing Potion (50 GP)“
Location summary
Section titled “Location summary”For a Location with population, government_type, and region:
A {government_type} in {region}, population {population}→ “A Republic in The Vale, population 12000”
Spell stat block header
Section titled “Spell stat block header”For a Spell:
Level {level} {school} ({casting_time}, range {range})→ “Level 3 Evocation (1 action, range 60 feet)“
Use the live preview. The editor shows a preview underneath the template box with sample values. If your preview doesn’t look right, your template doesn’t read right.
Keep templates short. A template that fills three lines starts to feel like programming. If you’ve got that much logic, switch to a Formula or split into multiple smaller fields.
Templates aren’t searchable as-is. The result is computed at display time and isn’t indexed for search. If users want to search by full name, also keep first_name and last_name as their own fields.
One template, one purpose. Don’t try to make a single template work for every subtype. Use visibility rules to swap in a different template field per subtype if needed.