<?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: Variable: display only part of the value in DQL</title>
    <link>https://community.dynatrace.com/t5/DQL/Variable-display-only-part-of-the-value/m-p/249450#M1022</link>
    <description>&lt;P&gt;You can parse out complete information from tag string. Here is just a bit more complex query getting all parts of tag:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.host
| fields tags
| expand tags
| parse tags, """(('[' , LD:tag.context , ']' , LD:tag.name ) | LD:tag.name) ':' LD:tag.value"""
| summarize { tag.values=collectDistinct( tag.value ) }, by: { tag.context, tag.name }
| fieldsAdd tag.values.size = arraySize(tag.values)&lt;/LI-CODE&gt;&lt;P&gt;summarizing all possible contexts (even if not present) and tag names. Result looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_2-1719607211242.png" style="width: 851px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20840i99136A7905641FE6/image-dimensions/851x551?v=v2" width="851" height="551" role="button" title="krzysztof_hoja_2-1719607211242.png" alt="krzysztof_hoja_2-1719607211242.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2024 20:43:24 GMT</pubDate>
    <dc:creator>krzysztof_hoja</dc:creator>
    <dc:date>2024-06-28T20:43:24Z</dc:date>
    <item>
      <title>Variable: display only part of the value</title>
      <link>https://community.dynatrace.com/t5/DQL/Variable-display-only-part-of-the-value/m-p/249369#M1020</link>
      <description>&lt;P&gt;I have a variable defined as such:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;fetch `dt.entity.cloudsqs`
| fields tags
| expand tags
| filter contains(tags, "[AWS]environment")
| sort tags asc
| summarize environments = collectDistinct(tags)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;which is practical because later on, when the variable is used, I can use the value as-is without transformations&lt;/P&gt;
&lt;P&gt;However, this display values as "&lt;STRONG&gt;[AWS]environment:prod&lt;/STRONG&gt;", which I find to be quite bad UX&lt;BR /&gt;With a query like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;fetch dt.entity.cloud‌‌sqs
| fields tags
| expand tags
| filter contains(tags, "[AWS]environment")
| parse tags, """LD ':' LD:value"""
| fieldsRemove tags
| sort value asc
| summarize environments = collectDistinct(value)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I can get only my values, but the variable is hard to use as it is not the complete tag&lt;/P&gt;
&lt;P&gt;Is there a way to display only the value and get the tag? Or a good way to transform from one to the other later on (while using multi-select)?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 10:59:05 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Variable-display-only-part-of-the-value/m-p/249369#M1020</guid>
      <dc:creator>aled</dc:creator>
      <dc:date>2024-07-01T10:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Variable: display only part of the value</title>
      <link>https://community.dynatrace.com/t5/DQL/Variable-display-only-part-of-the-value/m-p/249450#M1022</link>
      <description>&lt;P&gt;You can parse out complete information from tag string. Here is just a bit more complex query getting all parts of tag:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;fetch dt.entity.host
| fields tags
| expand tags
| parse tags, """(('[' , LD:tag.context , ']' , LD:tag.name ) | LD:tag.name) ':' LD:tag.value"""
| summarize { tag.values=collectDistinct( tag.value ) }, by: { tag.context, tag.name }
| fieldsAdd tag.values.size = arraySize(tag.values)&lt;/LI-CODE&gt;&lt;P&gt;summarizing all possible contexts (even if not present) and tag names. Result looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="krzysztof_hoja_2-1719607211242.png" style="width: 851px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20840i99136A7905641FE6/image-dimensions/851x551?v=v2" width="851" height="551" role="button" title="krzysztof_hoja_2-1719607211242.png" alt="krzysztof_hoja_2-1719607211242.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 20:43:24 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/DQL/Variable-display-only-part-of-the-value/m-p/249450#M1022</guid>
      <dc:creator>krzysztof_hoja</dc:creator>
      <dc:date>2024-06-28T20:43:24Z</dc:date>
    </item>
  </channel>
</rss>

