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 dealing with currency or decimals, confirm you pass properly formatted numeric strings (e.g., "9.99"). Otherwise, rounding errors can occur.