Increment the Sequence Variable within a Loop Integration

Use this recipe to increment the sequence or counter variable within a data mapper while processing data in batches.

Note:

This recipe is available as Oracle Increment Variable Inside Loop in the Integration Store. Oracle provides this recipe as a sample only. The recipe is meant only for guidance, and is not warranted to be error-free. No support is provided for this recipe.

Overview

The Increment Counter Variable recipe uses a REST Adapter to fetch or receive data in batches from an external application. This recipe enables you to increment the sequence or counter variable within a data mapper, using the position( ) function, for each batch of data that's processed.

You can invoke the REST API using the following command to post data to the recipe:
POST: https://host:port/ic/api/integration/v1/flows/rest/ORCL-R-INCREM_VARIAB_INSIDE_LOOP/1.0/ITER
Example Input Payload:
{"accounting": [ { "firstName": "John1", "lastName": "Doe1", "age": 23 }  , { "firstName": "John2", "lastName": "Doe2", "age": 33 } ,  { "firstName": "John3", "lastName": "Doe3", "age": 44 } ,  { "firstName": "John4", "lastName": "Doe4", "age": 53 } ,  { "firstName": "John5", "lastName": "Doe5", "age": 63 }] }
Example Output Payload:
{
    "Accounting": [
        {
            "Seq": "1",
            "Employee": {
                "firstName": "John1",
                "lastName": "Doe1",
                "age": 23
            }
        },
        {
            "Seq": "2",
            "Employee": {
                "firstName": "John2",
                "lastName": "Doe2",
                "age": 33
            }
        },
        {
            "Seq": "3",
            "Employee": {
                "firstName": "John3",
                "lastName": "Doe3",
                "age": 44
            }
        },
        {
            "Seq": "4",
            "Employee": {
                "firstName": "John4",
                "lastName": "Doe4",
                "age": 53
            }
        },
        {
            "Seq": "5",
            "Employee": {
                "firstName": "John5",
                "lastName": "Doe5",
                "age": 63
            }
        }
    ],
    "errorOccurred": "false"
}

System and Access Requirements

  • Oracle Integration

Install, Configure, and Run the Recipe

For more information and steps to install, configure, and run recipes, see Get Started with Integration Accelerators and Recipes.