Search code examples
etlmappersnaplogic

How to do addition in mapper using snaplogic?


I want to do the addition of two input using mapper and send the data dynamically from the Postman in the form of JSON. So, want to add that data coming from the Postman.


Solution

  • I assume you will have a simple pipeline with only one mapper. Something as follows.

    enter image description here

    Say you take two variables a and b as input from the JSON like as follows.

    {
        "a": 2,
        "b": 5
    }
    

    Then you can have an expression like $a + $b and map it to another output variable like $c. Please refer to the following screenshot.

    enter image description here

    You can then create a triggered task for this pipeline and fire from Postman with the above JSON as the body. Please refer to the following screenshot.

    enter image description here