Skip to main content Skip to complementary content

Filtering loop elements on their index

Use an IndexRangeLoop function to filter elements in a loop based on their index.

Before you begin

You have created a map with an input and output structure. You can use the sample provided below.

About this task

In this example, you have a CSV file containing employee information. You want to filter this data to skip the first two employees on the list. You can use the following CSV sample to create a structure and use it as both input and output in your map:
firstName,lastName,salary
Steve,Rogers,185
Tony,Stark,200
Natasha,Romanoff,175
Bruce,Banner,150
Clint,Barton,135

Procedure

  1. Drag and drop an IndexRangeLoop function in the Loop tab of the output row element.
  2. Drag and drop the input row element on the Input Map Element argument.
  3. Drag and drop a Constant function on the Start Index argument.
  4. Double-click the Constant function and enter 3 in the Value field, then click OK.
    This expression allows you to specify the first index to include in the loop.
  5. Optional: Add a Constant function on the End Index argument to specify the last index to include in the loop.
    If it is not specified, all iterations from the Start Index to the last index are included.
  6. Drag and drop the input row element on the corresponding output to map the child elements.

Results

Your map is configured and should look like this:
You can use the Test Run feature to see the result. In this example, the following output is returned:
firstName,lastName,salary
Natasha,Romanoff,175
Bruce,Banner,150
Clint,Barton,135

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!