Dynamic Field Functions
Text Helpers
Number Helpers
Logic Helpers
Date Helpers
Text Helpers
lowercase
Turns a string to lowercase.
Parameters: none.
Usage:
//field_100 = "THIS IS A TEST STRING"
{{lowercase field_100}}
this is a test string
uppercase
Turns a string to uppercase. Opposite of {{lowercase}}
.
Parameters: none.
Usage:
//field_100 = "this is a test string"
{{uppercase field_100}}
THIS IS A TEST STRING
capitalizeFirst
Capitalizes the first word in a string.
Parameters: none.
Usage:
//field_100 = "this is a test string"
{{capitalizeFirst field_100}}
This is a test string
capitalizeEach
Capitalizes each word in a string.
Parameters: none.
Usage:
//field_100 = "this is a test string"
{{capitalizeEach field_100}}
This Is A Test String
titleize
Capitalizes all words within a string.
Parameters: none.
Usage:
//field_100 = "this_is_a_test_string"
{{titleize field_100}}
This Is a Test String
sentence
Capitalizes the first word of each sentence in a string and converts the rest of the sentence to lowercase.
Parameters: none.
Usage:
//field_100 = "this is string 1. this is string two."
{{sentence field_100}}
This is string 1. This is string two.
reverse
Reverses a string.
Parameters: none.
Usage:
//field_100 = "this is a test string"
{{reverse field_100}}
gnirts tset a si siht
truncate
Truncates a string given a specified length
, providing a custom string to denote an omission
.
Parameters:
length [int] - The number of characters to keep (Required)
omission [string] - A string to denote an omission (Optional)
Usage:
//field_100 = "This is a longer test string that will be truncated."
{{truncate field_100 10 "..."}}
This is a lo...
center
Centers a string using non-breaking spaces.
Parameters:
spaces [int] - The number of spaces. (Required)
Usage:
Please note the triple curly braces since this will output HTML.
//field_100 = "this is a test string"
{{{center field_100 10}}}
this is a test string
newLineToBr
Converts new line characters \n
to line breaks <br>
.
Usage:
//field_100 = "this is a \n test string."
{{{newLineToBr field_100}}}
this is a <br> test string.
sanitize
Sanitizes strings for safe use in URLs and file names.
Parameters:
replacement [string] - A replacement character (Optional)
Usage:
//field_100 = "this is a test string & so is this."
{{{sanitize field_100 "-"}}}
this-is-a-test-string--so-is-this-
inflect
Returns the plural or singular form of a word based on a count.
Parameters:
singular [string] - The singular form of the word. (Required)
plural [string] - The plural form of the word. (Required)
include [boolean] - whether or not to include the count before the word. (Optional)
Usage:
field_100 = 0
field_101 = 1
{{inflect field_100 "lead" "leads"}}
{{inflect field_101 "customer" "customers" true}}
lead
1 customer
ordinalize
Turns a number into an ordinal string.
Usage:
//field_100 = 3
//field_101 = 1
//field_102 = 22
{{ordinalize field_100}}
{{ordinalize field_101}}
{{ordinalize field_102}}
3rd
1st
22nd
Number Helpers
toFixed
Returns exactly digits
after the decimal place. The number is rounded if necessary, and the fractional part is padded with zeros if necessary so that it has the specified length.
Parameters:
digits [int] - The number of digits to appear after the decimal point. (Optional)
Usage:
//field_100 = 5.53231
{{toFixed field_100 3}}
5.532
toPrecision
Returns the number in fixed-point or exponential notation rounded to precision
significant digits.
Parameters:
precision [int] - The number of digits. If omitted, it returns the entire number (without any formatting). (Optional)
Usage:
//field_100 = 555.322
{{toPrecision field_100 4}}
555.3
toExponential
Returns the number in exponential notation with one digit before the decimal point, rounded to fractions
digits after the decimal point.
Parameters:
fractions [int] - An integer specifying the number of digits after the decimal point. (Optional)
Usage:
//field_100 = 5
{{toExponential field_100 5}}
5.00000e+0
toInt
Returns an integer.
Parameters: none.
Usage:
//field_100 = '22.2abc'
{{toInt field_100}}
22
toFloat
Returns a floating point number.
Parameters: none.
Usage:
//field_100 = '22.2abc'
{{toFloat field_100}}
22.2
digitGrouping
Adds thousands separator to a number.
Parameters:
separator [string] - A string to use as a digit group separator. (Optional)
Usage:
//field_100 = 2222222
{{digitGrouping field_100}}
2,222,222
add
Returns the sum of two numbers.
Parameters:
value [int] - The number to add to the expression. (Required)
Usage:
//field_100 = 100
{{add field_100 5}}
105
subtract
Returns the difference of two numbers. Opposite of add
Parameters:
value [int] - The number to subtract from the expression. (Required)
Usage:
//field_100 = 100
{{subtract field_100 5}}
95
divide
Returns the division of two numbers.
Parameters:
value [int] - The number to divide the expression. (Required)
Usage:
//field_100 = 100
{{divide field_100 10}}
10
multiply
Returns the multiplication of two numbers.
Parameters:
value [int] - The number to multiply the expression. (Required)
Usage:
//field_100 = 100
{{multiply field_100 10}}
1000
floor
Returns the value rounded down to the nearest integer.
Usage:
//field_100 = 100.5
{{floor field_100}}
100
ceil
Returns the value rounded up to the nearest integer.
Usage:
//field_100= 100.6
{{ceil field_100}}
101
round
Returns the value rounded to the nearest integer.
Usage:
//field_100 = 100.69
{{round field_100}}
101
Logic Helpers
if
The If helper will check if a field value exists. If the condition is met, the code between the opening helper tag and closing helper tag will be processed.
{{#if field_37}}
{{multiply field_37 10}}
{{/if}}
You can also add an 'else' statement if the condition is not met.
{{#if field_37}}
// Do something
{{else}}
// Otherwise, do something else
{{/if}}
unless
The Unless helper will check if a field value is blank. If the condition is met, the code between the opening helper tag and closing helper tag will be processed.
{{#unless field_37}}
//Unless field_37 is set, the code here will run.
{{/unless}}
You can also add an 'else' statement if the condition is not met.
{{#unless field_37}}
// Do something
{{else}}
// Otherwise, do something else
{{/unless}}
is
Conditionally render a block if the condition is true.
Parameters:
value [string|int] - the value to test against.
Usage:
//field_100 = 5
{{#is field_100 5}}
Field 100 is equal to 5
{{else}}
Field 100 is not equal to 5
{{/is}}
-or with strings-//field_100 = "Lead"
{{#is field_35 "Lead"}}
This customer is a Lead
{{else}}
Customer is not yet a lead.
{{/is}}
isnt
Conditionally render a block if the condition is false. Opposite of is
.
Parameters:
value [string|int] - the value to test against.
Usage:
//field_100 = 5
{{#isnt field_100 5}}
Field 100 isn't 5!
{{else}}
Field 100 is 5
{{/isnt}}
Never mind :(
gt
Conditionally render a block if the value is greater than a given number.
Parameters:
value [string|int] - the value to test against.
Usage:
//field_100 = 5
{{#gt field_100 8}}
Field 100 is not greater than 8
{{else}}
Field 100 is greater than 8
{{/gt}}
Output: Field 100 is greater than 8
gte
Conditionally render a block if the value is greater or equal than a given number.
Parameters:
value [string|int] - the value to test against.
Usage:
//field_100 = 5
{{#gte field_100 5}}
Field 100 is greater than or equal to 5
{{else}}
Field 100 is NOT greater than or equal to 5
{{/gte}}
Output: Field 100 is greater than or equal to 5
lt
Conditionally render a block if the value is less than a given number. Opposite of gt
.
Parameters:
value [string|int] - the value to test against.
Usage:
//field_100 = 5
{{#lt field_100 3}}
Field 100 is less than 3
{{else}}
Field 100 is not less than 3
{{/lt}}
Output: Field 100 is not less than 3
lte
Conditionally render a block if the value is less or equal than a given number. Opposite of gte
.
Parameters:
value [string|int] - the value to test against.
Usage:
//field_100 = 5
{{#lte field_100 5}}
Field 100 is less than or equal to 5
{{else}}
Field 100 is NOT less than or equal to 5
{{/lte}}
Output: Field 100 is less than or equal to 5
or
Conditionally render a block if one of the values is truthy.
Parameters:
values [string|int] - the values to test against.
Usage:
field_100 = true
field_101 = false
{{#or field_100 field_101}}
Field 100 OR field 101 is true
{{else}}
Neither Field 100 OR field 101 are true
{{/or}}
Outptut: Field 100 OR field 101 is true
and
Conditionally render a block if both values are truthy.
Parameters:
values [string|int] - the values to test against.
Usage:
field_100 = true
field_101 = false
{{#and field_100 field_101}}
Field 100 and Field 101 are both true
{{else}}
Field 100 and Field 101 are NOT both true
{{/and}}
Output: Field 100 and Field 101 are NOT both true
Date Helpers
Format options:
Date (Year, Month, Day):
%Y - Year with century (can be negative, 4 digits at least)
-0001, 0000, 1995, 2009, 14292, etc.
%C - year / 100 (round down. 20 in 2009)
%y - year % 100 (00..99)
%m - Month of the year, zero-padded (01..12)
%_m blank-padded ( 1..12)
%-m no-padded (1..12)
%B - The full month name (``January'')
%^B uppercased (``JANUARY'')
%b - The abbreviated month name (``Jan'')
%^b uppercased (``JAN'')
%h - Equivalent to %b
%d - Day of the month, zero-padded (01..31)
%-d no-padded (1..31)
%e - Day of the month, blank-padded ( 1..31)
%j - Day of the year (001..366)
Time (Hour, Minute, Second, Subsecond):
%H - Hour of the day, 24-hour clock, zero-padded (00..23)
%k - Hour of the day, 24-hour clock, blank-padded ( 0..23)
%I - Hour of the day, 12-hour clock, zero-padded (01..12)
%l - Hour of the day, 12-hour clock, blank-padded ( 1..12)
%P - Meridian indicator, lowercase (``am'' or ``pm'')
%p - Meridian indicator, uppercase (``AM'' or ``PM'')
%M - Minute of the hour (00..59)
%S - Second of the minute (00..60)
%L - Millisecond of the second (000..999)
%N - Fractional seconds digits, default is 9 digits (nanosecond)
%3N millisecond (3 digits)
%6N microsecond (6 digits)
%9N nanosecond (9 digits)
%12N picosecond (12 digits)
Time zone:
%z - Time zone as hour and minute offset from UTC (e.g. +0900)
%:z - hour and minute offset from UTC with a colon (e.g. +09:00)
%::z - hour, minute and second offset from UTC (e.g. +09:00:00)
%Z - Time zone abbreviation name
Weekday:
%A - The full weekday name (``Sunday'')
%^A uppercased (``SUNDAY'')
%a - The abbreviated name (``Sun'')
%^a uppercased (``SUN'')
%u - Day of the week (Monday is 1, 1..7)
%w - Day of the week (Sunday is 0, 0..6)
ISO 8601 week-based year and week number:
The week 1 of YYYY starts with a Monday and includes YYYY-01-04.
The days in the year before the first week are in the last week of
the previous year.
%G - The week-based year
%g - The last 2 digits of the week-based year (00..99)
%V - Week number of the week-based year (01..53)
Week number:
The week 1 of YYYY starts with a Sunday or Monday (according to %U
or %W). The days in the year before the first week are in week 0.
%U - Week number of the year. The week starts with Sunday. (00..53)
%W - Week number of the year. The week starts with Monday. (00..53)
Seconds since the Epoch:
%s - Number of seconds since 1970-01-01 00:00:00 UTC.
Literal string:
%n - Newline character (\n)
%t - Tab character (\t)
%% - Literal ``%'' character
Combination:
%c - date and time (%a %b %e %T %Y)
%D - Date (%m/%d/%y)
%F - The ISO 8601 date format (%Y-%m-%d)
%v - VMS date (%e-%^b-%4Y)
%x - Same as %D
%X - Same as %T
%r - 12-hour time (%I:%M:%S %p)
%R - 24-hour time (%H:%M)
%T - 24-hour time (%H:%M:%S)
Interval Options:
Example:
{{dateAdd field_91 '1 day' '%Y-%m-%d %I:%M %p'}}
The following intervals can be used:
- minute
- hour
- day
- week
- month
- year
formatDate
Formats a date into a string given a format. Accepts any value that can be passed to new Date()
.
Parameters:
format [string] - The format string
Usage:
//field_100 = 2021-05-01
{{formatDate field_34 "%m/%d/%Y"}}
<br>
{{formatDate field_34 "%I:%M%p"}}
<br>
{{formatDate field_34 "%F"}}
<br>
{{formatDate field_34 "%Y%m%dT%H%M%S%z"}}
2021-05-20
05/19/2021
05:00PM
2021-05-19
20210519T170000-0007
now
Returns the current date.
Parameters:
format [string] - The format string
Usage:
{{now}}
{{now "%m/%d/%Y"}}
Thu Jul 26 2012 23:41:02 GMT-0400 (AST)
07/26/2012
timeago
Returns a human-readable time phrase from the given date.
Usage:
//field_100 = 2021-05-01
{{timeago field_100}}
4 days ago
age
Calculates the age in years between a date and now.
Parameters:
Usage:
dateAdd
Adds a specified interval to a date value.
Parameters:
interval [int|string] - The interval to be subtracted
format [string] - The format string
Usage:
{{dateAdd field_101 '1 day' '%Y-%m-%d'}}
dateSub
Subtracts a specified interval from a date value.
Parameters:
interval [int|string] - The interval to be subtracted
format [string] - The format string
Usage:
{{dateSub field_101 '1 day' %'Y-%m-%d'}}
dateDiff
Calculates the difference between two dates.
Parameters:
format [string] - The format string
Usage:
{{dateDiff field_101 field_102 '%a'}}
We'd love to hear your feedback.