Performing Arithmetic Operations

Communication Cloud Service lets you perform arithmetic operations on integers and decimal values. The <comms-tranform> tag with type attribute lets you specify the arithmetic operation to perform on the input data.

The following table lists the arithmetic operations:

Arithmetic Operation Output
Sum Returns the summation of two input values.
Difference Returns the difference between two numbers.
Multiply Returns the numerical product of the two numbers by multiplying them.
Division Returns the numerical quotient of two numbers.
Syntax
<comms-transform type="sum"> <comms-data>$Data{"Id":"Field1"}</comms-data> <comms-data>$Data{"Id":"Field2"}</comms-data></comms-transform>

Assembly Template

{
    "$$Id": "ArithmeticEvent",
    "Fields": [
        {
            "Name": "NumberField1",
            "Path": "$.NumberField1"
        },
        {
            "Name": "NumberField2",
            "Path": "$.NumberField2"
        }
    ]
}
Example
<comms-data>$Data{"Id":" ArithmeticOutput "} <comms-transform type="sum"> <comms-data>$Data{"Id":"NumberField1"}</comms-data> <comms-data>$Data{"Id":"NumberField2"}</comms-data> </comms-transform></comms-data>
Sample Data
{ “NumberField1”:100, “NumberField2”:2,}
Output
ArithmeticOutput = 102