<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DQL How to Flatten an Array in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Flatten-Arrays-in-Dynatrace-Query-Language-DQL/m-p/251147#M1074</link>
    <description>&lt;P&gt;Wow, you replied to one of my other DQL questions with a similarly advanced query.&amp;nbsp; Not sure how you've learned all this advanced stuff given what's available in the documentation that Dynatrace has provided...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have some secret source of documentation, tips, and examples that the rest of us mere mortals don't have access to, or did you figure all this stuff out on your own?&lt;/P&gt;</description>
    <pubDate>Sun, 21 Jul 2024 19:29:31 GMT</pubDate>
    <dc:creator>36Krazyfists</dc:creator>
    <dc:date>2024-07-21T19:29:31Z</dc:date>
    <item>
      <title>Flatten Arrays in Dynatrace Query Language (DQL)</title>
      <link>https://community.dynatrace.com/t5/DQL/Flatten-Arrays-in-Dynatrace-Query-Language-DQL/m-p/251098#M1072</link>
      <description>&lt;P&gt;&lt;EM&gt;Summary:&amp;nbsp;This article demonstrates how to flatten arrays using DQL functions. It provides syntax examples and practical use cases for transforming complex data structures in Dynatrace dashboards.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;So you can flatten records to individual columns using the fieldsFlatten command, but there's no way to flatten arrays.&amp;nbsp; You can expand arrays, but that creates separate rows for each element in an array.&amp;nbsp; I want columns made for each element in the array.&lt;/P&gt;
&lt;P&gt;Here's the query I'm running:&lt;/P&gt;
&lt;PRE&gt;fetch dt.entity.host&lt;BR /&gt;| fieldsAdd state, osVersion, managementZones&lt;BR /&gt;| filter state == "OFFLINE"&lt;BR /&gt;| sort entity.name&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The managementZones column has arrays of management zones in it.&amp;nbsp; I want to flatten that into columns of management zones (so mzone1, mzone2, mzone3, mzone4, etc...).&amp;nbsp; Or, if it's easier, the management zone names could become columns with something like TRUE/FALSE in the cell as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anybody know if this is possible?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2026 13:22:11 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Flatten-Arrays-in-Dynatrace-Query-Language-DQL/m-p/251098#M1072</guid>
      <dc:creator>36Krazyfists</dc:creator>
      <dc:date>2026-01-21T13:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: DQL How to Flatten an Array</title>
      <link>https://community.dynatrace.com/t5/DQL/Flatten-Arrays-in-Dynatrace-Query-Language-DQL/m-p/251125#M1073</link>
      <description>&lt;P&gt;No, unfortunately it is not possible to do in clean DQL, however it is possible to workaround it using DPL and string representation of the array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.host
| fieldsAdd managementZones=array(managementZones[],true)
| fieldsAdd managementZones= toString(managementZones)
| parse managementZones, "'[' KVP{ '[' DQS:key ', ' BOOLEAN:value ']' ', '?}:mz ']'"
| fieldsFlatten mz
| fieldsRemove managementZones, mz&lt;/LI-CODE&gt;&lt;P&gt;The result looks for me like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1721422124670.png" style="width: 859px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/21243i2BB02F74BE0DF909/image-dimensions/859x262?v=v2" width="859" height="262" role="button" title="krzysztof_hoja_0-1721422124670.png" alt="krzysztof_hoja_0-1721422124670.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;true is value of the fields names as management zone. When host is not in management zone the filed is simply missing&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2024 20:50:27 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Flatten-Arrays-in-Dynatrace-Query-Language-DQL/m-p/251125#M1073</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-07-19T20:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: DQL How to Flatten an Array</title>
      <link>https://community.dynatrace.com/t5/DQL/Flatten-Arrays-in-Dynatrace-Query-Language-DQL/m-p/251147#M1074</link>
      <description>&lt;P&gt;Wow, you replied to one of my other DQL questions with a similarly advanced query.&amp;nbsp; Not sure how you've learned all this advanced stuff given what's available in the documentation that Dynatrace has provided...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have some secret source of documentation, tips, and examples that the rest of us mere mortals don't have access to, or did you figure all this stuff out on your own?&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jul 2024 19:29:31 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Flatten-Arrays-in-Dynatrace-Query-Language-DQL/m-p/251147#M1074</guid>
      <dc:creator>36Krazyfists</dc:creator>
      <dc:date>2024-07-21T19:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: DQL How to Flatten an Array</title>
      <link>https://community.dynatrace.com/t5/DQL/Flatten-Arrays-in-Dynatrace-Query-Language-DQL/m-p/254775#M1165</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/41155"&gt;@36Krazyfists&lt;/a&gt;&amp;nbsp; &amp;nbsp;you have articulated very well what I am thinking...&amp;nbsp; &amp;nbsp; There need to be more examples in the docs.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2024 09:13:50 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Flatten-Arrays-in-Dynatrace-Query-Language-DQL/m-p/254775#M1165</guid>
      <dc:creator>HeadScratcher</dc:creator>
      <dc:date>2024-09-03T09:13:50Z</dc:date>
    </item>
  </channel>
</rss>

