# DQL variable with tag values stopped working

**URL:** <https://community.dynatrace.com/t/dql-variable-with-tag-values-stopped-working/40933>\
**Category:** DQL\
**Tags:** dql\
**Created:** [July 31, 2023, 1:53am UTC](https://community.dynatrace.com/t/dql-variable-with-tag-values-stopped-working/40933 "2023-07-31T01:53:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarcioKaue](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@MarcioKaue](https://community.dynatrace.com/u/MarcioKaue)\
**Post date:** [July 31, 2023, 1:53am UTC](https://community.dynatrace.com/t/dql-variable-with-tag-values-stopped-working/40933/1 "2023-07-31T01:53:54Z")

</div>

Hello,

We were using a Dashboard with a selector filter that has the existing values of a tag in our hosts for the use case of this Dashboard, but this week the DQL query using the variable stopped working (before it was working normally).

**Query DQL:**

fetch dt.entity.host  
| fieldsAdd tags  
| expand tags  
| summarize tags = collectDistinct(tags)  
| expand tags  
| parse tags, “”“((LD:tag (!\<\<‘\\’ ‘:’)LD:value) |LD:tag)”“”  
| fields tag = replaceString(tag, “”“\:”“”, “:”), value = replaceString(value, “”“\:”“”, “:”)  
| filter toString(tag) == “MyTag”  
| fields value

Could anyone support?

---

<div class="post-metadata">

**Author:** ![Fin\_Ubels](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/fin_ubels/32/18008_2.png) [@Fin\_Ubels](https://community.dynatrace.com/u/Fin_Ubels)\
**Post date:** [July 31, 2023, 3:17am UTC](https://community.dynatrace.com/t/dql-variable-with-tag-values-stopped-working/40933/2 "2023-07-31T03:17:20Z")

</div>

Hey Marcio,

I ran the same query in my environment and it is working just fine. Could you provide some context as to what about it isn’t working and what its purpose is?

In my below example I tagged a synthetic with “Test:SomeTag” and the query, as expected, returns “SomeTag” when the input tag string is “Test”:

 ![Fin_Ubels_0-1690773350692.png](https://global.discourse-cdn.com/dynatrace/original/3X/a/0/a00f0659261419bdde07272b32bfef79e4495e5a.png)

---

<div class="post-metadata">

**Author:** ![MarcioKaue](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@MarcioKaue](https://community.dynatrace.com/u/MarcioKaue)\
**Post date:** [July 31, 2023, 2:21pm UTC](https://community.dynatrace.com/t/dql-variable-with-tag-values-stopped-working/40933/3 "2023-07-31T14:21:59Z")

</div>

Hello&nbsp;[@Fin\_Ubels](https://community.dynatrace.com/user/47376)&nbsp;,

I need to bring all the values of a tag to use as a variable in a Dashboard.

Here is an example, if I even use the “parse” function, the DQL returns all tags and values

 ![DQL-sucess.PNG](https://global.discourse-cdn.com/dynatrace/original/3X/5/6/5653ad0c13aab19c4a8084ef1485da67afecb2ad.png)

If I filter by a tag value, the error I mentioned occurs:

 ![DQL-error.PNG](https://global.discourse-cdn.com/dynatrace/original/3X/9/a/9ac92d73289af1dfdcb457d96e64500ce5213ffb.png)

---

<div class="post-metadata">

**Author:** ![Fin\_Ubels](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/fin_ubels/32/18008_2.png) [@Fin\_Ubels](https://community.dynatrace.com/u/Fin_Ubels)\
**Post date:** [July 31, 2023, 10:46pm UTC](https://community.dynatrace.com/t/dql-variable-with-tag-values-stopped-working/40933/4 "2023-07-31T22:46:39Z")

</div>

Hey Marcio,

For such an error I would suggest opening a support ticket if you haven’t already so that they can look deeper behind the scenes.

In the meantime, would a different query like this work in your situation?

 ![Fin_Ubels_0-1690843489566.png](https://global.discourse-cdn.com/dynatrace/original/2X/5/5e9143afe9ed0c58c60da30f60b9536470cbe2b8.png)

---

<div class="post-metadata">

**Author:** ![MarcioKaue](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@MarcioKaue](https://community.dynatrace.com/u/MarcioKaue)\
**Post date:** [August 1, 2023, 12:57pm UTC](https://community.dynatrace.com/t/dql-variable-with-tag-values-stopped-working/40933/5 "2023-08-01T12:57:48Z")

</div>

I was able to identify that the “_fields_” function for some reason was not being accepted (the error message is not clear as to why).

Here is the DQL that brings the same result in another way:

fetch dt.entity.host  
| expand tags  
| summarize tags = collectDistinct(tags)  
| expand tags  
| parse tags, “”“((LD:tag (!\<\<‘\\’ ‘:’)LD:value) |LD:tag)”“”  
| fieldsAdd tag = replaceString(tag,“”“\:”“”, “:”), value = replaceString(value, “”“\:”“”, “:”)  
| filter toString(tag) == “MyTag”  
| fieldsRemove tags, tag
