# Expanding Multiple arrays

**URL:** <https://community.dynatrace.com/t/expanding-multiple-arrays/49012>\
**Category:** DQL\
**Tags:** dql\
**Created:** [November 21, 2024, 3:01pm UTC](https://community.dynatrace.com/t/expanding-multiple-arrays/49012 "2024-11-21T15:01:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javin\_Singh](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@Javin\_Singh](https://community.dynatrace.com/u/Javin_Singh)\
**Post date:** [November 21, 2024, 3:01pm UTC](https://community.dynatrace.com/t/expanding-multiple-arrays/49012/1 "2024-11-21T15:01:08Z")

</div>

I am trying to expand multiple arrays in 3 separate columns (“Host\_Metric”, “Start” and “End”). Each array in all 3 columns has 97 elements.

I am trying to expand each of the arrays into records. However, when I used the “expand” command, each array element keeps multiplying with the elements of the other arrays, creating many duplicates with wrong information.

I simply want to expand all 3 arrays into their corresponding 97 records with their indexes in the same order. Is this possible?

 ![Capture1.PNG](https://global.discourse-cdn.com/dynatrace/original/2X/9/9082b2d6214aabe1ad546752140580c067b09abe.png)

---

<div class="post-metadata">

**Author:** ![Tiit\_Hallas](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@Tiit\_Hallas](https://community.dynatrace.com/u/Tiit_Hallas)\
**Post date:** [November 25, 2024, 8:17am UTC](https://community.dynatrace.com/t/expanding-multiple-arrays/49012/2 "2024-11-25T08:17:24Z")

</div>

Do I understand you correctly that:

1. you have three arrays: a = [1,2] , b = [3,4] , c = [5,6]  
2. you expect the output to be:

```markup
a | b | c
---------
1 | 3 | 5
2 | 4 | 6

```

if so, the [iCollectArray](https://docs.dynatrace.com/docs/shortlink/dql-operators#iCollectArray)&nbsp;function and the following query can help you:

```markup
data record(
  a = array(1,2,3),
  b = array(4,5,6),
  c = array(7,8,9)
)
| fields all = iCollectArray(record(first = a[], second = b[],third = c[]))
| expand all
| fieldsFlatten all

```

I created a demo for you in the Security investigator in our Playground as well, you can access it at [Dynatrace](https://wkf10640.apps.dynatrace.com/ui/apps/dynatrace.security.investigator/share/4c1b0392-60fc-4d21-aebb-0c3dd8ace1f5)

Does this solve your problem?

---

<div class="post-metadata">

**Author:** ![Javin\_Singh](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@Javin\_Singh](https://community.dynatrace.com/u/Javin_Singh)\
**Post date:** [November 25, 2024, 8:39am UTC](https://community.dynatrace.com/t/expanding-multiple-arrays/49012/3 "2024-11-25T08:39:19Z")

</div>

Thank you. This solved my problem.
