Runtime verified Differs from official docs Test scripts included

Syntax

Multiply(number1, number2)  →  number
2 arguments — exactly

Parameters

Name Type Required Description
number1 string | number Yes First operand
number2 string | number Yes Second operand

Exactly two arguments. Numbers written as strings are accepted.

Example

%%=Multiply(6, 7)=%%

Renders 42.

String and number operands can be mixed:

%%=Multiply("4", 2.5)=%%

Renders 10.

Return value

number — the product of the two operands.

Every call that rendered gave a bare number. There is no set of special values to test for.

Behaviour

Exactly two arguments. An email that calls Multiply(5) or Multiply(5, 3, 1) cannot be saved: the content API answers HTTP 400 with “The AMPscript syntax isn’t valid”.

The result is rounded to two decimals. Multiply(1.5, 2.25) renders 3.38, not 3.375.

Negatives work. Multiply(-5, 3) gives -15.

Numeric strings are accepted. Multiply("6", "7") gives 42, Multiply("5", "3") gives 15, and Multiply("4", 2.5) gives 10.

Large products are not clamped. Multiply(1000000, 1000000) gives 1000000000000.

"true" counts as 1. Multiply("true", 1) renders 1 instead of failing.

Other non-numeric input fails. Multiply("abc", 1) makes the email preview fail with HTTP 500.

Show Next test script
<!-- Marketing Cloud Next test script for Multiply. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[42] got=[%%=Multiply(6,7)=%%]</p>
<p>c2 expect=[42] got=[%%=Multiply("6","7")=%%]</p>
<p>c3 expect=[3.38] got=[%%=Multiply(1.5,2.25)=%%]</p>
<p>c4 expect=[1000000000000] got=[%%=Multiply(1000000,1000000)=%%]</p>
<p>c5 expect=[15] got=[%%=Multiply(5,3)=%%]</p>
<p>c6 expect=[15] got=[%%=Multiply("5","3")=%%]</p>
<p>c7 expect=[10] got=[%%=Multiply("4",2.5)=%%]</p>
<p>c8 expect=[-15] got=[%%=Multiply(-5,3)=%%]</p>
<p>c9 expect=[1] got=[%%=Multiply("true",1)=%%]</p>

Show calls that fail in Next (one email each)
<!-- Run each call below in its own Next email: one of them in a combined email
     would stop the whole preview or block the save. -->

<!-- email 1: expect that the save is rejected (HTTP 400) -->
%%=Multiply(5)=%%

<!-- email 2: expect that the save is rejected (HTTP 400) -->
%%=Multiply(5,3,1)=%%

<!-- email 3: expect that the email saves, but the preview fails (HTTP 500) -->
%%=Multiply("abc",1)=%%

Differs from official docs

  • Two-decimal rounding. The official reference allows decimal operands and mentions no rounding. In Next, Multiply(1.5, 2.25) renders 3.38, not 3.375. Details

Availability & differences

PlatformAvailable
Marketing Cloud EngagementYes
Marketing Cloud NextYes, from API 67.0

See also