<?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 How to subtract arrays in DQL? in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/How-to-subtract-arrays-in-DQL/m-p/270972#M1746</link>
    <description>&lt;P&gt;I want to find out the diff between two arrays and list them out with DQL.&lt;/P&gt;&lt;P&gt;Something like | fields array1, array2, diff&lt;/P&gt;&lt;P&gt;Diff needs to be calculated but not sure how to do that.&lt;/P&gt;&lt;P&gt;Here I have&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;array 1 = ["apple", "orange", "lychee", "grapes", "pineapple"]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;array 2 = ["apple", "orange", "lychee"]&lt;/P&gt;&lt;P&gt;Then I would like diff result to be ["grapes", "pineapple"].&lt;/P&gt;&lt;P&gt;How can I get diff through DQL?&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Feb 2025 16:45:58 GMT</pubDate>
    <dc:creator>bretonne</dc:creator>
    <dc:date>2025-02-25T16:45:58Z</dc:date>
    <item>
      <title>How to subtract arrays in DQL?</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-subtract-arrays-in-DQL/m-p/270972#M1746</link>
      <description>&lt;P&gt;I want to find out the diff between two arrays and list them out with DQL.&lt;/P&gt;&lt;P&gt;Something like | fields array1, array2, diff&lt;/P&gt;&lt;P&gt;Diff needs to be calculated but not sure how to do that.&lt;/P&gt;&lt;P&gt;Here I have&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;array 1 = ["apple", "orange", "lychee", "grapes", "pineapple"]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;array 2 = ["apple", "orange", "lychee"]&lt;/P&gt;&lt;P&gt;Then I would like diff result to be ["grapes", "pineapple"].&lt;/P&gt;&lt;P&gt;How can I get diff through DQL?&lt;/P&gt;&lt;P&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2025 16:45:58 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-subtract-arrays-in-DQL/m-p/270972#M1746</guid>
      <dc:creator>bretonne</dc:creator>
      <dc:date>2025-02-25T16:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to subtract arrays in DQL?</title>
      <link>https://community.dynatrace.com/t5/DQL/How-to-subtract-arrays-in-DQL/m-p/271298#M1763</link>
      <description>&lt;P&gt;Yes, it is possible with iterative expressions and &lt;EM&gt;&lt;STRONG&gt;arrayIndexOf&lt;/STRONG&gt;&lt;/EM&gt; function. You need to check for each element of 1st array if it does not exist in 2nd array.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data record(a1=array( "apple", "orange", "lychee", "grapes", "pineapple" ), a2=array("apple", "orange", "lychee") )
| fieldsAdd diff = arrayRemoveNulls(iCollectArray(if ( arrayIndexOf( a2, a1[] ) &amp;lt; 0, a1[])))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_0-1740731256619.png" style="width: 846px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/26734i520B02C6D8570C6A/image-dimensions/846x168?v=v2" width="846" height="168" role="button" title="krzysztof_hoja_0-1740731256619.png" alt="krzysztof_hoja_0-1740731256619.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 08:27:59 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/How-to-subtract-arrays-in-DQL/m-p/271298#M1763</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2025-02-28T08:27:59Z</dc:date>
    </item>
  </channel>
</rss>

