cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Expanding Multiple arrays

Javin_Singh
Visitor

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?

2 REPLIES 2

Tiit_Hallas
Dynatrace Helper
Dynatrace Helper

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:

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

 if so, the iCollectArray function and the following query can help you:

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 https://wkf10640.apps.dynatrace.com/ui/apps/dynatrace.security.investigator/share/4c1b0392-60fc-4d21...

Does this solve your problem?

I had a life once. Then I bought my first computer ...

Javin_Singh
Visitor

Thank you. This solved my problem.

Featured Posts