Comment on page
Formatting Your Data
This section guides you to format your data. For example, you want to display your text in uppercase or lowercase and much more. Here formatting doesn't mean styling your content (font, size, color).
Here is a list of available modifiers/helpers. These modifiers/helpers are added along with the tokens(merge field).
Modifier/Helper | Description | Example |
---|---|---|
Uppercase | Convert all characters to uppercase | {{upper FieldName}} |
Lowercase | Convert all characters to lowercase | {{lower FieldName}} |
Capitalize | Capitalize the first letter | {{capitalize FieldName}}
{{capitalize FieldName format="words"}} |
Abbreviation | Convert text to abbreviation (First letter of each word in caps) | {{abbreviate FieldName "."}} |
Pad | Appends or prepends a single character repeatedly to fill input to given width. | {{pad number 9}} {{pad number 5 pad_with='*' style='suffix'}} |
Concat | Appends text. | {{concat string1 string2}} |
Format Date | Change the format of date, datetime | {{format_date _date format="DD-MM-YY"}}
{{format_date _date format="DD-MMMM-YYYY" locale="fr"}}
{{format_date _date format="DD-MMMM-YYYY" locale="en" offset="+3 years"}} |
Format Number | Change the format of a number (thousands and decimals) | {{format_number number decimal_separator="."}}
{{format_number number thousand_separator=","}}
{{format_number number precision="2"}}
{{format_number number thousand_separator="," decimal_separator="." precision="3"}} |
Format Phone | Change the format of your phone number.
It can also be used to format a number | {{format_phone landline "(%3) %3-%4"}} |
Number to words | Converts the input number in to words. | {{number_to_words input}} |
Number to Ordinal | Converts the input number to its ordinal form, in words. | {{number_to_ordinal input}} |
Join | Joins the input array of strings with given separator (defaults to , ) | {{join items ", "}} {{join FieldName ", " lookup="object.name"}} |
Replace | Replaces the match string from input with given replace string | {{replace str1 str2}{{replace FieldName (regex "[0-9]" "g") "*"}} |
Regex | Return a RegExp class instance with given pattern and flags | {{replace FieldName (regex "(0-9)" "g") "*"}} |
Split | Splits input with given separator (defaults to , ) | {{#each (split Fieldname ", ")}} ... {{/each}} |
Strip | Strips the input of given match characters (defaults to white space) from given position ( left or right or both ) | {{strip FieldName}} {{strip FieldName "*" side="left"}} |
Sort | Sorts input in the given order ( asc , desc ) | {{# list (sort FieldName lookup="price" order="asc")}} ... {{/list}} {{#list (sort Fieldname order="asc")}} ... {{/list}} |
Var | Can be used to store and retrieve the data within the template | {{var "FieldName" 500}} {{var "FieldName"}} |
Group by | Groups data by given lookup. | {{#each (group_by FieldName lookup="company")}}..... {{/each}} |
Insert Link | Inserts a URL or Hyperlink in the document | {{insert_link url text="clickable display text"}} |
Url Encode | Replaces special characters inside a URL with encoded text. | {{url_encode URL is_url=true|false}} |
Url Decode | Decodes encoded URLs into pre-encoded forms. | {{url_decode URL is_url=true|false}} |
Rand | Returns a random value between the specified minimum and maximum values. | {{rand min max}} |
As Number | Converts any given input to a valid number. | {{as_number FieldName}} |
As String | Converts any given input to a valid string. | {{as_string FieldName}} |
As Boolean | Converts any given input to True or False. | {{as_boolean FieldName}} |
Syntax:
{{format_date token_name format="format" locale="language_code" offset="add/subtract time"}}
1 | format | No | MM-DD-YYYY |
---|---|---|---|
2 | language code | No | en English(United States) |
3 | add/subtract time | No | ​ |
Example | Input | Output |
---|---|---|
{{format_date _date format="DD-MM-YY"}} | 2019-05-25 | 25-05-19 |
{{format_date _date format="MMMM DD YYYY" locale="fr"}} | 2019-05-25 | mai 25 2019 |
{{format_date _date format="MMMM DD YYYY" locale="en" offset="+1years"}} | 2019-08-20 | August 20 2020 |
{{format_date _date offset="+1years"}} | 2019-08-20 | 08-20-2020 |
Example formats | Output |
---|---|
DD-MM-YY | 21-11-18 |
Do-MM-YY | 6th-08-21 |
ddd MMM DD HH:mm:ss | Wed Nov 21 14:08:25 |
MMMM DD YYYY HH:mm:ss | November 21 2018 14:08:25 |
MMMM DD YYYY | November 21 2018 |
MMM DD YYYY | Nov 21 2018 |
YYYY-MM-DD | 2018-11-21 |
MM-DD-YYYY | 01-22-2006 |
MM/DD/YYYY | 01/22/2006 |
MM/DD/YY | 01/22/06 |
DD-MM-YYYY | 22-01-2006 |
DD/MM/YYYY | 22/01/2006 |
DD/MM/YY | 22/01/06 |
X | 1542758400 |
Text | Token | Output |
---|---|---|
Year | YYYY | 2000, 2001, 2002 ... 2012, 2013 |
​ | YY | 00, 01, 02 ... 12, 13 |
Month | MMMM | January, February, March ... |
​ | MMM | Jan, Feb, Mar ... |
​ | MM | 01, 02, 03 ... 11, 12 |
​ | M | 1, 2, 3 ... 11, 12 |
Day of Year | DDDD | 001, 002, 003 ... 364, 365 |
​ | DDD | 1, 2, 3 ... 364, 365 |
Day of Month | DD | 01, 02, 03 ... 30, 31 |
​ | D | 1, 2, 3 ... 30, 31 |
​ | Do | 1st, 2nd, 3rd, 4th ...... 30th, 31st |
Day of Week | dddd | Monday, Tuesday, Wednesday ... |
​ | ddd | Mon, Tue, Wed ... |
​ | d | 1, 2, 3 ... 6, 7 |
Hour | HH | 00, 01, 02 ... 23, 24 |
​ | H | 0, 1, 2 ... 23, 24 |
​ | hh | 01, 02, 03 ... 11, 12 |
​ | h | 1, 2, 3 ... 11, 12 |
AM / PM | A | AM, PM |
​ | a | am, pm |
Minute | mm | 00, 01, 02 ... 58, 59 |
​ | m | 0, 1, 2 ... 58, 59 |
Second | ss | 00, 01, 02 ... 58, 59 |
​ | s | 0, 1, 2 ... 58, 59 |
Sub-second | SSS | 000, 001, 002 ... 998, 999 |
​ | SS | 00, 01, 02 ... 98, 99 |
​ | S | 0, 1, 2 ... 8, 9 |
Timestamp | X | 1381685817 |
Language code | Language & Country |
---|---|
en-au | English (Australia) |
en-ca | English (Canada) |
en-ie | English (Ireland) |
en-il | English (Israel) |
en-nz | English (New Zealand) |
en-gb | English (United Kingdom) |
fr | French |
fr-ca | French (Canada) |
fr-ch | French (Switzerland) |
de | German |
de-at | German (Austria) |
de-ch | German (Switzerland) |
hu | Hungarian |
pt | Portuguese |
To adjust a date/time by a specific amount, you need to supply
<+/-> <amount as a number> <unit>
as the value for offset. Unit can be "years", "months", "weeks", "days", "hours", "minutes", or "seconds". Here are some examples:+1hours
-3days
+5years+2months-3minutes
+8h
Example | Input | Output |
---|---|---|
{{format_date _date format="MMMM DD YYYY" locale="en" offset"+1years"}} | 2019-08-20 | August 20 2020 |
{{format_date _date format="MMMM DD, YYYY" offset="+6months"}} | 2019-08-20 | February 20, 2020 |
{{format_date _date offset="+1years"}} | 2019-08-20 | 08-20-2020 |
Syntax:
{{format_number number output_format="in" thousand_separator="thousand_sep" decimal_separator="decimal_sep" precision="number_of_decimal_places"}}
Example | Input | Output |
---|---|---|
{{format_number price thousand_separator="." precision="0"}} | 123456 | 123.456 |
{{format_number invoice_total thousand_separator="." decimal_separator="," precision="3"}} | 12345.12345 | 12.345,123 |
{{format_number number precision="2"}} | 123456 | 123,456.00 |
{{format_number number decimal_separator=","}} | 909.876 | 909,876 |
{{format_number number output_format="in"}} | 87904.987 | 87,904.987 |
{{format_number number output_format="in" thousand_separator="," decimal_separator="." precision="2"}} | 87904.987 | 87,904.99 |
Syntax:
{{abbreviate FieldName suffix}}
The Suffix is not mandatory.
Example | Input(name) | Output |
---|---|---|
{{abbreviate name}} | John Doe | JD |
{{abbreviate name "."}} | John Doe | J.D |
Syntax:
{{format_phone landline "format"}}
Example | Input | Output |
---|---|---|
{{format_phone landline "(%3) %3-%4"}} | 9878072739 | (987) 807-2739 |
{{format_phone landline "+1-%3-%3-%4"}} | 9876543210 | +1-987-654-3210 |
{{format_phone credit_card_number "%4-%4-%4-%4"}} | 1234567890123456 | 1234-5678-9012-3456 |
Format:
{{number_to_words input output_format="in" suffix=" " decimal_suffix=" " language=" "}}
Example | Input | Output |
---|---|---|
{{number_to_words number}} | 123456 | one hundred and twenty-three thousand four hundred and fifty-six |
{{capitalize (number_to_words amount suffix="dollars" decimal_suffix="cents")}} | 800.658 | Eight hundred dollars six hundred and fifty-eight cents |
{{number_to_words currency output_format="in" suffix="rupees" decimal_suffix="paise"}} | 9893.567 | nine thousand eight hundred and ninety-three rupees five hundred and sixty-seven paise |
{{number_to_words price output_format="in" suffix="rupees"}} | 7000000 | seventy lakh rupees |
{{number_to words price suffix="dollars"}} | 7000000 | seven million dollars |
{{number_to_words input language="fr"}} | 8795 | huit mille sept cent quatre-vingt-quinze |
{{number_to_words price suffix="Dollars" decimal_suffix="Cents" language="de"}} | 8790.345 | achttausendsiebenhundertneunzig Dollars dreihundertfünfundvierzig Cents |
Format:
{{number_to_ordinal Number}}
ExampleInput | Output | Text |
---|---|---|
{{number_to_ordinal Number}} | 800 | eight hundreth |
{{capitalize (number_to_ordinal number1)}} | 582 | Five hundred and eighty-second |
{{number_to_ordinal number}} | 789.325 | seven hundred and eighty-ninth |
Syntax:
{{join content separator lookup="lookup_key"}}
Example 1:
{{join SampleName ","}}
Input(SampleName) | Output |
---|---|
John Mary Paul | John,Mary,Paul |
Example 2:
{{join employees lookup="Name.Firstname"}}
Input(employees.Name) | Output |
---|---|
Firstname Lastname Peter Parker Tony Stark Steve Rogers | Peter,Tony,Steve |
Syntax:
{{replace input match_str replace_str}}
( Here the match_str can be either a text or regex)Example | Input | Output |
---|---|---|
{{replace input to_replace replacer}} | Input to_replace replacer MaryRoss Ross Jane | MaryJane |
{{replace input (regex "[a]" "g") "e"}} | Ragax | Regex |
Syntax:
{{regex pattern flags}}
(No flags are set by default).Example | Input | Output |
---|---|---|
{{replace content (regex "[a-z]" "g") "*"}} | MaryJane123 | M***J***123 |
{{replace data (regex "[0-9]+" "g") "$"}} | 1239HomeAlone42 | *HomeAlone* |
Syntax:
{{strip input match_str side=side}}
Example | Input | Output |
---|---|---|
{{strip input}} | WallMart | WallMart |
{{strip input "@" side="right"}} | @JohnDoe@ | @JohnDoe |
Syntax:
{{split input separator}}
(separator can either be text or Regex)Example | Input(FieldName) | Output |
---|---|---|
{{#list (split FieldName ",")}}
{{/list}} | John,Doe,Cleveland |
|
{{#list (split FieldName (regex "\d+" "g"))}}
{{/list}} | John12Doe34Cleveland |
|
Syntax:
{{sort content order=order lookup="lookup_key"}}
Example 1:
{{#each (sort cost order="desc")}}
{{this}}
{{/each}}
Input | Output |
---|---|
750 150 500 | 150 500 750 |
Example 2:
{{#each (sort items lookup="price" order="asc")}}
{{name}} is available at {{price}} per {{unit}}.
{{/each}}
Input | Output |
---|---|
Name Price Unit Pen 20 5 Pencil 10 4 Book 25 3 | Pencil is available at 10 per 4. Pen is available at 20 per 5. Book is available at 25 per 3. |
Note : The helpers Split, Sort and Regex are Sub-Expression only helpers which can be used with loop helpers like
each
and list
Syntax:
{{var "token" value}}
Example | Output |
---|---|
{{var "cost" 500}} | Here the token cost is assigned a value of 500. |
{{var "price" 7599}} | Here the token price is assigned a value of 7599. |
{{var "amount" MRP}} | Here the value in token MRP is assigned to the token amount. |
Syntax:
{{var "token"}}
Example | Output |
---|---|
{{var "cost"}} | 500 |
{{var "price"}} | 7599 |
Pad helper fills up the input to the desired width by adding a single character repeatedly either at the beginning or at the end.
Syntax:
{{pad number output_width pad_with='character' style='prefix|suffix'}}
Example 1:
{{pad number 7}}
Input | Output |
---|---|
123 | 0000123 |
Example 2:
{{pad number 9 pad_with='#' style='suffix'}}
Input | Output |
---|---|
123456 | 123456### |
Syntax :
{{concat string1 string2 ....}}
Example:
{{insert_image (concat "https:" url) 300 300}}
Input:
//raw.githubusercontent.com/tiholic/exif-orientation-examples/master/Portrait_0.jpg
Output:

Group by helper groups the data with the value of lookup key as grouping criteria.
Syntax:
{{group_by FieldName lookup="lookup_key"}}
Key
and items
can be accessed from inside the iterator(#each
or #list
). Key
contains value of "lookup_key"
for the current record, items
contain the records which are present under current group.Example 1:
{{#each (group_by employees lookup="role.code")}}
Number of employees in role {{key}}: {{items.length}} and they are {{join items ", " lookup="name.first"}}
{{/each}}
Input: (JSON)
{
"employees": [
{ "role":{ "code": "TL" }, "name": { "first": "Dave" } },
{ "role": { "code": "TL" }, "name": { "first": "Chris" } },
{ "role": { "code": "PM" }, "name": { "first": "Matt" } },
{ "role": { "code": "TL" }, "name": { "first": "Emma" } },
{ "role": { "code": "PM" }, "name": { "first": "Jenn" } }
]
}
Output :
Number of employees in role TL: 3 and they are Dave, Chris, Emma
Number of employees in role PM: 2 and they are Matt, Jenn
In the above example,
- "TL" and "PM" are the group
keys
. items
corresponding to the key "TL" are :{ "role": { "code": "TL" }, "name": { "first": "Emma" } }
{ "role": { "code": "TL" }, "name": { "first": "Chris" } }
{ "role":{ "code": "TL" }, "name": { "first": "Dave" } }
items
corresponding to the key "PM" are:{ "role": { "code": "PM" }, "name": { "first": "Jenn" } }
{ "role": { "code": "PM" }, "name": { "first": "Matt" } }
Example 2:
{{#each (group_by places)}}
Number of branches in {{key}}: {{items.length}}
{{/each}}
Input: (JSON)
{
"places": [
"New York",
"Las Vegas",
"Chicago",
"New York",
"Las Vegas",
"New York"
]
}
Output:
Number of branches in New York: 3
Number of branches in Las Vegas: 2
Number of branches in Chicago: 1
In the above example,
- "New York", "Las Vegas" and "Chicago" are the group
keys
. - Number of
items
corresponding to the key "New York" are 3. - Number of
items
corresponding to the key "Las Vegas" are 3. - Number of
items
corresponding to the key "Chicago" is 1.
To insert a dynamic URL into your document.
Format:
{{insert_link url text=text}}
Example | Input | Output |
---|---|---|
{{insert_link url}} | url=https://docupilot.app/ | |
{{insert_link url text=url_text}} | url=https://docupilot.app/ url_text="Example" | |
{{insert_link url text="Click Here"}} | url=https://docupilot.app/ |
Inserted hyperlinks follow the source style in Builder templates. In case of Word Document templates, style customization can be done by opening Format > Styles > Search and select "Hyperlink" > click Modify > Update to desired style and click Ok
URL encode helper replaces special characters inside a URL with encoded text.
Syntax :
{{url_encode URL is_url=true|false}}
Example1:
Syntax in Template
{{url_encode url is_url=true}}
Input sent to the template (JSON):
{
"url": "https://dummyimage.com/600x400/000/fff&text=hello world"
}
Generated Output:
https://dummyimage.com/600x400/000/fff&text=hello%20world
Example2:
Syntax in Template
https://example.com?open={{url_encode url_part is_url=false}}
Input sent to the template (JSON):
{
"url_part": "https://dummyimage.com/600x400/000/fff&text=hello world"
}
Generated Output:
https://example.com?open=https%3A%2F%2Fdummyimage.com%2F600x400%2F000%2Ffff%26text%3Dhello%20world
URL decode helper decodes encoded URLs into pre-encoded forms.
Syntax :
{{url_decode URL is_url=true|false}}
Example1:
Syntax in Template
{{url_decode url is_url=true}}
Input sent to the template (JSON):
{
"url": "https://dummyimage.com/600x400/000/fff&text=hello%20world"
}
Generated Output:
https://dummyimage.com/600x400/000/fff&text=hello world
Example2:
Syntax in Template
{{url_decode url is_url=false}}
Input sent to the template (JSON):
{
"url": "https%3A%2F%2Fdummyimage.com%2F600x400%2F000%2Ffff%26text%3Dhello%20world"
}
Generated Output:
https://dummyimage.com/600x400/000/fff&text=hello world
Encoding or decoding a URL depends on the value of the parameter 'is_url'. If the value is true, only the query parameter part of the complete URL is encoded/decoded else, the whole of the URL is encoded/decoded.
The Default value of is_url is set as false.
Rand helper will return a random value between the min and max values passed.
Syntax:
{{rand min max}}
Example | Input | Output |
---|---|---|
{{rand min max}} | min: 2
max: 500 | could be any random number between 2 and 500
Ex: 436.89318 |
{{round (rand min max)}} | min: 2
max: 500 | could be any random integer value ex: 437 |
rand helper returns a float value between the min and max values. To get an integral value, we need to use the round helper in tandem with the rand helper.
As Number helper converts any given input to a valid number.
Syntax:
{{as_number FieldName}}
Example | Input | Output |
---|---|---|
{{as_number value}} | value: "23.000"(string) | 23(numerical value) |
{{#if (as_number input_value) "<=" 100}}
Value is less than 100.
{{else}}
Value is greater than 100.
{{/if}} | input_value: "98.767"(string) | Value is less than 100. |
{{#if (as_number input_value) "<=" 100}}
Value is less than 100.
{{else}}
Value is greater than 100.
{{/if}} | input_value: "101.9876"(string) | Value is greater than 100. |
As String helper converts any given input to a valid string.
Syntax:
{{as_string FieldName}}
Example | Input | Output |
---|---|---|
{{as_string value}} | value: 234.987 (numerical value) | "234.987" (String) |
{{#if (as_string input_value) "==" "23.000"}}
Success
{{else}}
Fail
{{/if}} | input_value: "23.000"(string) | Success |
{{#if (as_string input_value) "==" "23.000"}}
Success
{{else}}
Fail
{{/if}} | input_value: "23.00"(string) | Fail |
As Boolean helper converts any given input into Boolean values 0(False) and 1(True).
String:
{{as_boolean FieldName}}
Example | Input | Output |
---|---|---|
{{as_boolean value}} | value: 348 |