Math transform function

Introduction

The math transform function is used to perform a mathematical operation for selected fields. For example, your incoming payload might include customer records, each with a series of numeric value fields that need to be added together so the total can be pushed to a total field in the target system.

Available mathematical operations

The following mathematical operations are available:

  • Add

  • Subtract

  • Multiply

  • Divide

Adding a math transform

In the instructions below, we'll step through the scenario mentioned above where our incoming payload includes customer records, each with three value fields (value1, value2, value3) that must be added together and pushed to a total field in the target system.

The steps required are detailed in two stages:

Stage 1: Add all source fields to be totalled for the mapping row

To begin, we need to update/add the required mapping row so that it includes all source fields that need to be added together and then pushed to the target.

Step 1 In your process flow, access settings for your map shape:

Step 2 Find (or add) the mapping row which requires a math transformation. In the example below, we have a row that's currently set to map the source first name field into the destination full name field:

Step 3 On the source side of the mapping row, we need to include all the fields to be used in our mathematical operation. To do this, click the 'pencil' icon associated with the existing source field:

Step 4 Details for the selected field are shown - click the add source field button:

Step 5 Click the 'pencil' icon associated with the new source field:

Step 6 Move down and update the display name and payload fields for the second source field that you want to use - for example:

In our example, our source data is coming in via a manual payload so are defining the payload field manually - if you're using a connection shape to receive data, you'll be able to select the required field from the associated schema for your connection.

Step 7 Accept these changes to exit back to your mapping rows - notice that there are now two source fields associated with the row you updated:

Step 8 Repeat steps 3 to 7 to add any more source fields that you need to include in the mathematical operation.

Step 9 Go to stage 2.

Stage 2: Add a math transform function

With all required source fields defined for our mapping row, we can add a math transform function to define the required calculation based on these fields.

Step 1 Select the add transform button for the required mapping rule - for example:

Step 2 Click the add transform button:

Step 3 Click in the name field and select math from the number section in the list of transform functions:

...math options are displayed:

Step 4 Click in the operator field and select the type of calculation to be performed - you can choose from add, subtract, multiply and divide:

Step 5 Click the add field button:

Step 6 Click in source fields and select the first source field to be used in the calculation:

All source fields that were added for this mapping in stage 1 will be available for selection here.

Step 7 Accept your changes.

Step 8 Click the add field button again:

...and add the next source field to be used - for example:

Step 9 Accept your changes.

Step 10 Repeat steps 8 and 9 to include any more source fields to be used in the calculation. Each time you accept a new source field you'll see the sequence that they will be processed when this transform function runs - for example:

Fields are processed in the sequence that they are added here.

Step 11 Having added all required source fields to be calculated, accept changes:

...then save the function:

Step 12 Ensure that the target field for this mapping row is set as required, then save the map shape. Next time the process flow runs, the mathematical operation will be performed for the given source fields and the total value is pushed to the defined target field. The example below shows an incoming payload before and after the math transformation is applied:

Last updated