Articles in this section

multiply helper

Use multiply to return the product of two values. Each value can be a numeric field from the record or a string that can be parsed as a number. This is helpful for tasks such as computing extended prices (quantity * unitPrice), applying percentage-based discounts, or adjusting invoice totals.

Usage

{{multiply value1 value2}}
  • value1 and value2 can be numbers or numeric strings (e.g., "5", "10.75").
  • The output is a numeric result of the multiplication.

Examples

  1. Applying a discount

    {{multiply record.total "0.9"}}
    

    If record.total is 100, the output is 90 (a 10% discount).

  2. Calculating extended price

    {{multiply record.quantity record.unitPrice}}
    

    If record.quantity is "3" and record.unitPrice is 19.99, the output is 59.97.

  3. Combining hard-coded and dynamic values

    {{multiply "5" record.items.length}}
    

    If record.items.length is 4, the output is 20.

Tips

Tip

  • Make sure each value you pass in can be interpreted as a valid number. Non-numeric strings (like "abc") result in NaN.
  • Using double braces ({{ }}) vs. triple braces ({{{ }}}) for the output typically has minimal effect here, since the result is a numeric value.
  • When multiplying decimal values, the result can occasionally include trailing digits (for example, 9319.7 x 100 returning 931970.0000000001 instead of 931970). This is standard JavaScript floating-point behavior — some decimal values can't be represented exactly in binary — and it isn't specific to multiply or Handlebars. To get a clean result, wrap the output with the round helper, for example: {{round (multiply record.TotalAmt 100)}}.