Skip to content

Templates

Templates allow formatting data attributes into strings. The are supported in a number of locations including Dispatch display.

Syntax is a normal string with data attributes escaped by { .. }. The attributes can be formatted with functions. Conditionals are also supported.

Functions

{value | function : parameters}
Function Name Example Result
capitalize Capitalize {user.name|capitalize} Harry
upper Upper case {user.name|capitalize} HARRY
date Date format {user.createdAt|date:MMM YYYY} Aug 2020
age Age in years {profile.dob|age} 25
time Format as time {values.time|time} 3:00pm
numeral Expressions {values.x+values.y|numeral} 10
percent As a percent {values.score|percent} 90%
timeRange Time range {13-14|timeRange} 1:00-2:00pm

Conditionals

{test ? value1 : value2}
{test ? value1 : value2 | function : parameters}

Examples

Example Result
{third, second} data 2
{user.createdAt | date:MMM YYYY} Jan 1980
{third, second |capitalize} Data 2
{ 1 is 1 ? first : second |capitalize} Data 1
{ value1 is 10 ? first : second |capitalize} Data 1
{ value2 is 'abc' ? first : second |capitalize} Data 1
{ value1 > 10 ? first : second |capitalize} Data 2
{ value3| numeral: 0% } 50%
{value3 | numeral: 0.00} 0.50
{data.values.second} data 2