Skip to content










Rounding

The rounding steps expect a value or a value and a scale:

  • A value can be a number or context variable resolving to a number.

  • A scale rounds a value to a specified decimal place. For example, scale 2 rounding up would round 15.657 to 15.66, while scale 1 would result in 15.7. No scale would result in 16.

Syntax

1
2
round <roundingMode Object> with scale <scale Number> as
    <roundedVariable Variable> using <roundingObject Any>

Parameters

  • roundingMode - The specified rounding mode. Must be one of:

    • up - Rounding mode to round away from zero.
    • down - Rounding mode to towards zero.
    • half down - Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.
    • half up - Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.
    • ceiling - Rounding mode to round towards positive infinity.
    • floor - Rounding mode to round towards negative infinity.
  • scale - The scale to round by. Any integer for practical purposes is supported.

  • roundedVariable - The variable that holds the rounded amount.

  • roundingObject - The object to be rounded. This can be any object that resolves to a number.

Example

1
2
And round up with scale 0 as callDur using B.incomingCalls[0].callDuration
And round half up with scale 1 as roundedVariable using 14.46

The first example above accesses the first incoming call's duration. Next it is saved as a context variable named callDur and rounds to whole seconds using the scale 0.

The second example above rounds 14.46 half up using a scale of 1. The result is saved as a context variable named roundedVariable.

This step is eligible for:

  • timed