# Loop through an array and get values from storage

**URL:** <https://forum.alumio.com/t/loop-through-an-array-and-get-values-from-storage/1088>\
**Category:** Data Transformers\
**Tags:** data-transformer\
**Created:** [April 16, 2024, 9:12am UTC](https://forum.alumio.com/t/loop-through-an-array-and-get-values-from-storage/1088 "2024-04-16T09:12:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brethren](https://forum.alumio.com/letter_avatar_proxy/v4/letter/b/9d8465/32.png) [@brethren](https://forum.alumio.com/u/brethren)\
**Post date:** [April 16, 2024, 9:12am UTC](https://forum.alumio.com/t/loop-through-an-array-and-get-values-from-storage/1088/1 "2024-04-16T09:12:00Z")

</div>

Hi,

I’m trying to loop through an array and transform it by getting the values from storage. Tried value mapper and node mapper and can’t make it work. There are no guides about it as well.

Say i have this data structure

```auto
{
"id": 1,
"values:[
{
"attribute_name_id": 1,
"attribute_value_id": 1,
},
{
"attribute_name_id": 2
"attribute_value_id": 3,
}
]
}

```

i need to transform it to a new array but the values will need to come from an entity that is already in storage

```auto
"id": 1,
"values:[
{
"name": "text from storage based on 1",
"value": "text from another storage based on 1"
},
{
"name": "text from storage based on 2",
"value": "text from another storage based on 3"
}
]
}

```

---

<div class="post-metadata">

**Author:** ![Gugi](https://forum.alumio.com/user_avatar/forum.alumio.com/gugi/32/236_2.png) [@Gugi](https://forum.alumio.com/u/Gugi)\
**Post date:** [April 16, 2024, 12:29pm UTC](https://forum.alumio.com/t/loop-through-an-array-and-get-values-from-storage/1088/2 "2024-04-16T12:29:33Z")

</div>

Hi @brethren,

Thank you for posting your question in the Alumio forum.

In order to loop through an array, you can use an entity transformer prototype called “Node, transform nodes”.

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

Under the “Node, transform nodes”, you can get any storage entity as much as you want.

---

<div class="post-metadata">

**Author:** ![brethren](https://forum.alumio.com/letter_avatar_proxy/v4/letter/b/9d8465/32.png) [@brethren](https://forum.alumio.com/u/brethren)\
**Post date:** [April 17, 2024, 3:16am UTC](https://forum.alumio.com/t/loop-through-an-array-and-get-values-from-storage/1088/3 "2024-04-17T03:16:48Z")

</div>

Hi @Gugi ,

Thanks. However, I’m trying to found out the following now

- the entity from the storage is an object so i just need the 1 field from there. Is this possible without creating another transformer?

- i need to access a parent value to concat from within the array. how do i do this?

---

<div class="post-metadata">

**Author:** ![Gugi](https://forum.alumio.com/user_avatar/forum.alumio.com/gugi/32/236_2.png) [@Gugi](https://forum.alumio.com/u/Gugi)\
**Post date:** [April 18, 2024, 6:21am UTC](https://forum.alumio.com/t/loop-through-an-array-and-get-values-from-storage/1088/4 "2024-04-18T06:21:45Z")

</div>

> [@brethren](#):
>
> the entity from the storage is an object so i just need the 1 field from there. Is this possible without creating another transformer?

Unfortunately, getting only one property from a storage entity is impossible at the moment. Therefore, you should put more transformer(s) to remove the other properties you don’t actually need.

> [@brethren](#):
>
> i need to access a parent value to concat from within the array. how do i do this?

When you are inside, a “Node, transform nodes”, it is not possible to get a value outside the array. I would suggest copying the values you need from the parent to the array using [Recursively copy values to children](https://forum.alumio.com/t/recursively-copy-values-to-children/287).
