# Generate Array Based on Start and Limits

**URL:** <https://forum.alumio.com/t/generate-array-based-on-start-and-limits/389>\
**Category:** Transformer Guides\
**Tags:** data-transformer\
**Created:** [January 13, 2023, 4:07am UTC](https://forum.alumio.com/t/generate-array-based-on-start-and-limits/389 "2023-01-13T04:07:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![r.candrian](https://forum.alumio.com/user_avatar/forum.alumio.com/r.candrian/32/235_2.png) [@r.candrian](https://forum.alumio.com/u/r.candrian)\
**Post date:** [January 13, 2023, 4:07am UTC](https://forum.alumio.com/t/generate-array-based-on-start-and-limits/389/1 "2023-01-13T04:07:45Z")

</div>

**Introduction**

When you are configuring for integration, there may be a need to create an array with configurable start and end limits.

For example, you want to create an array with the objects has **id** property starting from 4 to 7 through its objects, as below:

````
```
[ 
  { 
    "id": 4 
  }, 
  { 
    "id": 5 
  }, 
  { 
    "id": 6 
  }, 
  { 
    "id": 7 
  } 
] 
```

````

In this guide, we will show you how to do it within an entity transformer configuration.

Steps

1. First, you must include or set the limits ( **start** and **end** ) in the entity data. Example:

2. Chain multiple entity transformers is recommended because you will have more than one entity transformer if you create it in a single entity transformer.

3. Then, inside a Data, transform data using mappers and conditions, you need to subtract the end limit from the start limit using a value setter and an operator mapper (subtraction) to get the difference. To create an array from 4 to 7, add the Prepared Operator mapper (Addition) and set the Left to 1 (number).

 ![](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/1X/f80dbad46249049d8b107d85b097f47e62a1f3a8.png)

1. Next, after getting the difference, it should be converted to an array where the length equals to the difference using List: Fill the list with a value mapper and set the Length to &@, which represents the difference property’s current value. When the difference is **4** , the result is an array of integers, i.e., **[“4”, “4”, “4”, “4”]**.

 ![](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/1X/c541d5a095bc33a6d9bc3b987b0157f95264f803.png)

1. Then, the array should be converted to an array of objects using the Move data between accessors. The Source accessor is a Key accessor, and the Destination accessor is the Structure accessor. So, the array would be something like this:

 ![](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/1X/4b3209060a3692461a92f7b017389613b3f9aad9.png)

1. Then, we can copy the start limit to all the objects using the Recursively copy values to children transformer so that every object will have the start limit, such as below.

 ![](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/1X/2a1a2dba2b00416dceaf5f0e5dca08457415f701.png)

1. Then, inside a Node, transform nodes, you need to create a new attribute, for example, id, where the value is the sum of the index and start values.

 ![](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/1X/a419d2055ff8f16d3854e1f4fb7f9249093aa950.png)

1. Then you can remove other attributes, except id, using the Key Filter.

 ![](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/1X/d6ab6f8f1e44911d87d1e4903576cdba50d32b92.png)

1. Finally, in the data transformer (outside the node) use the List Mapper and the Get values mapper to tidy up the data structure.

 ![](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/1X/9f6fbdc617b7db16c6220c974cd5237d86d4d45d.png)

And here is the final result.

````
```
{ 
  "start": 4, 
  "end": 7, 
  "difference": [ 
    { 
      "id": 4 
    }, 
    { 
      "id": 5 
    }, 
    { 
      "id": 6 
    }, 
    { 
      "id": 7 
    } 
  ] 
} 
```

````
