# Variable: display only part of the value

**URL:** <https://community.dynatrace.com/t/variable-display-only-part-of-the-value/46362>\
**Category:** DQL\
**Tags:** dql, dashboards\
**Created:** [June 28, 2024, 8:34am UTC](https://community.dynatrace.com/t/variable-display-only-part-of-the-value/46362 "2024-06-28T08:34:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aled](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@aled](https://community.dynatrace.com/u/aled)\
**Post date:** [June 28, 2024, 8:34am UTC](https://community.dynatrace.com/t/variable-display-only-part-of-the-value/46362/1 "2024-06-28T08:34:45Z")

</div>

I have a variable defined as such:

```markup
fetch `dt.entity.cloudsqs`
| fields tags
| expand tags
| filter contains(tags, "[AWS]environment")
| sort tags asc
| summarize environments = collectDistinct(tags)

```

which is practical because later on, when the variable is used, I can use the value as-is without transformations

However, this display values as “**[AWS]environment:prod**”, which I find to be quite bad UX  
With a query like:

```markup
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)

```

I can get only my values, but the variable is hard to use as it is not the complete tag

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)?

---

<div class="post-metadata">

**Author:** ![krzysztof\_hoja](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/krzysztof_hoja/32/34625_2.png) [@krzysztof\_hoja](https://community.dynatrace.com/u/krzysztof_hoja)\
**Post date:** [June 28, 2024, 8:43pm UTC](https://community.dynatrace.com/t/variable-display-only-part-of-the-value/46362/2 "2024-06-28T20:43:24Z")

</div>

You can parse out complete information from tag string. Here is just a bit more complex query getting all parts of tag:

```markup
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)

```

summarizing all possible contexts (even if not present) and tag names. Result looks like this:

 ![krzysztof_hoja_2-1719607211242.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/5/f5cc3fb5060ef925c9d1866481639cfd97d19c0d.png)
