Articles in this section

subtract helper

Use the subtract helper to calculate the difference between two numbers (or numeric strings). You can pass numeric literals or fields from the Celigo context. If you provide string values (e.g., "6") instead of unquoted integers, ensure they represent valid numbers.

Usage

{{subtract minuend subtrahend}}
  • minuend: The first number or numeric field (e.g., 6 or record.total).

  • subtrahend: The second number or numeric field to subtract from the first.

Examples

  1. Subtracting literal values 

    {{subtract 6 3}}       → 3 {{subtract "6" "3"}}   → 3
  2. Subtracting values from the record 

    Given:

    {  "record": {    "ponies": "22",    "unicorns": "11",    "horses": 33  } }
    {{subtract ponies unicorns}}   → 11    (22 - 11) {{subtract horses 6}}          → 27    (33 - 6)
  3. Triple braces for raw numeric output 

    {{{subtract 10 4}}}

    Returns 6 without any automatic string formatting—identical in most numeric scenarios, but triple braces can be used if you need unformatted output.

Tip

  • If you’re passing numeric fields or integers, do not use quotes.

  • If you’re passing values as strings (e.g., "6"), verify they are valid numbers to avoid NaN or unexpected results.

  • The result is numeric, so double vs. triple braces typically won’t change the value, but triple braces return it without any possible formatting or quoting.