Apply Logic to Templates With Advanced Merge Fields
Learn how to display more advanced information on events using advanced merge field rules
Overview
In some scenarios, you may want to configure your event title, location, or description using some additional logic based on whether a field is blank. You can do so using combinations of specific characters to define sections of content that should only show if a specified field is blank or that should only show if the field is non-blank.
To specify that a section of content should only show if a specific field is non-blank, use two tags to wrap the section: {{#mergeField}} before the beginning of the section, where mergeField is the name of the merge field that should determine the section's visibility and {{/mergeField}} where mergeField is the same value as the first tag. You can put any content between these tags and the content will only show when mergeField is not blank.
Example 1: Display the block name in parenthesis, if there is one
{{Section.Description}} {{#if SectionMeeting.BlockName}} ({{SectionMeeting.BlockName}}){{/if}}
Result: "Algebra 1" or "Algebra 1 (B)"
But if the Spanish class is not scheduled into a block, it would look like: "Spanish"
Example 2: For Athletics - If there is a title for the athletic event, display it, but if there is not one, show instead the team and whether it is a game or practice:
{{#if AthleticEvent.Title}}{{AthleticEvent.Title}}{{else}}{{Team.Description}} {{AthleticEvent.EventType}}{{/if}}
Flow Template: Merge Syntax Examples
Class Schedules:
Description plus the block name in parenthesis (will not put an empty parenthesis if there is no block name):
{{Section.Description}} {{#if SectionMeeting.BlockName}} ({{SectionMeeting.BlockName}}){{/if}}
Result: "Algebra 1" or "Algebra 1 (B)"
As above but with a dash instead of parenthesis:
{{Section.Description}}{{#if SectionMeeting.BlockName}} - {{SectionMeeting.BlockName}}{{/if}}
Result: "Algebra 1" or "Algebra 1 - B"
Athletic Events:
Athletic events default to the event title. Some schools do not enter an event title for practices or games, creating events with no titles.
Event title, but if that does not exist, team name plus whether a game or practice:
{{#if AthleticEvent.Title}}{{AthleticEvent.Title}}{{else}}{{Team.Description}} {{AthleticEvent.EventType}}{{/if}}
Result: "Triple League Baseball Tournament" or "Boys Baseball Practice" or "Boys Baseball Game"
Event title - home or away (if it was entered):
{{AthleticEvent.Title}} {{#if AthleticEvent.HomeAway}} - {{AthleticEvent.HomeAway}}{{/if}}
Result: "Triple League Cross Country Meet" or "Triple League Cross Country Meet - Away"
Team name and type and, if there is an opponent, include "vs Opponent Name" at the end:
{{Team.Description}} {{AthleticEvent.EventType}} {{#if AthleticEvent.Opponent}} vs {{AthleticEvent.Opponent}}{{/if}}
Result: "Girls Softball Practice" or "Girls Softball Game vs Green School"
Group Events:
Location, if input; otherwise, internal resource:{{#if GroupEvent.Location}}{{GroupEvent.Location}}{{else}}{{GroupEvent.ResourceName}}{{/if}}
Result: "Room 260" or internal resource name (depending on how the location was entered)
Settings