Skip to main content
Skip table of contents

Template Helpers

What are Helpers

Helpers are convenient functions designed to help you personalize your template or format data retrieved from individual Bookmarks.

When added to the editor, the bookmarks have the following format:

CODE
{{#HelperName … }}             

Access Helpers

The helpers can be accessed from the bookmarks panel located next to the template content editor. You can access this panel when creating or editing a template.

For details about creating or editing templates, see this article: Templates: Managing Templates.

Helper Types

General Utilities

  1. Current Date/Time {{#now [“Date/Time format”]}}

    • You can add the current date/time generating the result through this helper. Noted, double quotes must be added.

    • If you don’t provide format, it follows the default format set in eBECAS/EDMISS.

    • For more details of formatting, visit here.

    • Example
      {{#now "dd MMMM yyyy"}} → 13 July 2023
      {{#now "MM/dd/yyyy"}} → 13/07/2023

  2. Yes/No {{#yesno |FieldApiName|}}

    • Fields of type checkbox return the values as True or False. Using this helper you can convert these values into more friendly values: Yes and No.

    • If the value is True, it will be converted to Yes.

    • If the value is False, it will be converted to No.

    • If the value is not True/False but another type of data value such as simple text or number, it will be converted to No for output.

    • Example
      {{students-os_student}}, {{#yesno students-os_student}} → True, Yes
      {{students-online_student}}, {{#yesno online_student}} → False, No
      {{students-first_name}}, {{#yesno students-first_name}} → Ryan, No
      {{students-age}}, {{#yesno students-age}} → 24, No
      {{#date students-dob "dd/MM/yyyy"}}, {{#yesno students-dob}} → 03/01/2000, No

Format

  1. Date {{#date |FieldApiName| "DateFormat"}}

    • You can convert the format of Date through this helper.

    • This helper requires 2 arguments. FieldApiName should be the field that you want to convert and format is the same as Current Date/Time but it doesn’t support Time format.

    • For more details of formatting, visit here.

    • Example
      {{#date offer_courses-start_date "dd MMMM yyyy"}} → 13 July 2023
      {{#date offer_courses-start_date "dd/MM/yyyy"}} → 13/07/2023

  2. Currency {{#currency |FieldApiName|}}

    • You can add the currency unit through this helper. It follows your regional format where you’re located.

    • Format can be various depending on your location/country.

    • Example
      {{offer-course_amount}} → 20000
      {{#currency offers-course_amount}} → $ 20000

    Most of currency fields in eBECAS/EDMISS is already combined with this helper. Use this helper if you need to add new field with currency.

  3. Percent {{#percent |FieldApiName| [Precision]}}

    • You can add percentage unit and decimal places through this helper displaying the value of a field as percentage by adding the % symbol.

    • Precision represents a number how many decimal places you intend to display. If you don’t provide it, it’ll follow the default value same as the format in your database.

    • Example - A course with 50% discounted.
      {{offer_courses-discount_percent}} → 50
      {{#percent offer_courses-discount_percent}} → 50.00 %
      {{#percent offer_courses-discount_percent 0}} → 50 %
      {{#percent offer_courses-discount_percent 4}} → 50.0000 %

Formula

As Grid type template is about multiple values you need to show repeatedly, Sum currency helper shouldn't be placed in the grid template.

  1. Sum Currency (grid-field) {{#sumcurrency |GridApiName| |FieldApiName|}}

    • You can sum all the values of a single field in a grid and display the result as currency. This is very useful when you want to show total prices for offers or items.

    • GridApiName represents the name of Grid set(with a table icon).

    • FieldApiName represents the field that you'd like to sum all from the selected Grid container in GridApiName.

    • Example - An offer with ‘item1 $10’, ‘item2 $15’ and ‘item3 $18’
      {{#sumcurrency offer_items offer_items-total_amount}} → $33 (=$10 + $15 + $18)

  2. Sum Currency (single fields) {{#addcurrency |FieldApiName1| |FieldApiName2|}}

    • You can add the value of FieldApiName1 to the value of FieldApiName2 and formats the result as currency. This is much helpful when you need to simply add two currency fields.

    • FieldApiName1 and FieldApiName2 represent the fields that you'd like to add together. These fields must not be grid-fields.

    • Example - Course Amount is $100 and Agent Commission is $30.
      {{#addcurrency offers-course_amount offers-commission_amount}} → $130 (=$100 + $30)

  3. Sum Currency (grid-fields) {{#sumaddcurrency |GridApiName| |FieldApiName1| |FieldApiName2|}}

    • You can sum all the values of FieldApiName1 and FieldApiName2 in a grid and formats the result as currency. This is much helpful to display the total sum values for 2 different fields.

    • GridApiName represents the name of Grid set(with a table icon).

    • FieldApiName1 and FieldApiName2 represents the fields that you'd like to sum all from the selected Grid container in GridApiName. Both fields must be grid-fields.

    • Example - An offer with ‘Course1 $100 with Commission $20', ‘Course2 $150 with Commission $30' and ‘Course3 $80 with Commission $10'.
      {{#sumaddcurrency offer_courses offer_courses-amount offer_courses-commission_amount}} → $390 (=$100 + $20 + $150 + $30 + $80 + $10)

  4. Subtract Currency (single fields) {{#subtractcurrency |FieldApiName1| |FieldApiName2|}}

    • You can subtract the value of FieldApiName2 from the value of FieldApiName1 and format the result as currency. It’s useful to display differences between 2 currency fields.

    • FieldApiName1 and FieldApiName2 represent the fields that you'd like to subtract. It’ll subtract the value of FieldApiName2 from FieldApiName1. These fields must not be grid-fields.

    • Example - Course Amount is $100 and Agent Commission is $30.
      {{#subtractcurrency offers-course_amount offers-commission_amount}} → $70 (=$100 - $30)

  5. Subtract currency (grid-fields) {{#sumsubtractcurrency |GridApiName| |FieldApiName1| |FieldApiName2|}}

    1. You can subtract the sum of FieldApiName2 from the sum FieldApiName1 in a grid and formats the result as currency. This means it calculates the difference between the value of FieldApiName1 and the value of FieldApiName2 for each entry in a grid. Then, sum up all these calculated differences.

    2. FieldApiName1 and FieldApiName2 represent the fields that you'd like to subtract from the selected Grid container in GridApiName. Both fields must be grid-fields.

    3. Example - An offer with ‘Course1 $100 with Commission $20', ‘Course2 $150 with Commission $30' and ‘Course3 $80 with Commission $10'.
      {{#sumsubtractcurrency offer_courses offer_courses-amount offer_courses-commission_amount}} → $270 (= ($100 + $150 + $80) - ($20 + $30 + $10))

Document Utilities

  1. Page Break {{{#pagebreak}}}

    • Insert it to break a page by force on a document.

    • Unlike other helpers, It must be placed in the triple curly brackets.

  2. Page Number {{#pagenumber}}

    • It displays the current page number on a document.

  3. Total Page Number {{#numpages}}

    • It displays the total page number on a document.

Conditional

  1. Conditional Bookmark {{#ifcond |FieldApiName| |(eq) or (ne)| "ComparisonValue" "ValueIfTrue" "ValueIfFalse"}} 

    • FieldApiName: Identifier or variable for the field used for comparison.  

    • (eq) or (ne): Comparison operator, where eq stands for "equal" and ne stands for "not equal".  

    • "ComparisonValue": The value being compared with FieldApiName.  

    • "ValueIfTrue": Part of the template that is outputted when the condition is true.  

    • "ValueIfFalse": Part of the template that is outputted when the condition is false. 

  2. Conditional Block {{#if |FieldApiName|}} "BodyIfTrue" [{{else}} "BodyIfFalse"] {{/if}} 

    • FieldApiName: If this value exists, “BodyIfTrue” will display, otherwise “BodyIfFalse” will display. 

    • {{else}} “BodyIfFalse”: This is an optional part of the conditional statement that defines the template to be outputted if the condition is false. 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.