# DQL fields contains list of values

**URL:** <https://community.dynatrace.com/t/dql-fields-contains-list-of-values/50682>\
**Category:** DQL\
**Tags:** dql, logs\
**Created:** [March 12, 2025, 1:54pm UTC](https://community.dynatrace.com/t/dql-fields-contains-list-of-values/50682 "2025-03-12T13:54:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_S](https://avatars.discourse-cdn.com/v4/letter/n/2bfe46/32.png) [@Nicolas\_S](https://community.dynatrace.com/u/Nicolas_S)\
**Post date:** [March 12, 2025, 1:54pm UTC](https://community.dynatrace.com/t/dql-fields-contains-list-of-values/50682/1 "2025-03-12T13:54:21Z")

</div>

Hello,

From my logs, i need to add a tag “warning” if the reqPath field contains one of ID like “UID1” “UID2” “UID3” “UID4”.  
Davis Copilot Answer to this question is :

```javascript
fetch logs
| fieldsAdd warning = if(contains(reqPath, "UID1") OR contains(reqPath, "UID2") OR contains(reqPath, "UID3") OR contains(reqPath, "UID4"), "warning", else:NULL)

```

It works but it’s not possible to maintain with a list of hundreds of UID.

Is there a way in DQL to search a list of terms in a specific field?

Thanks and regards,

---

<div class="post-metadata">

**Author:** ![JeanBlanc](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/jeanblanc/32/25897_2.png) [@JeanBlanc](https://community.dynatrace.com/u/JeanBlanc)\
**Post date:** [April 14, 2025, 12:30pm UTC](https://community.dynatrace.com/t/dql-fields-contains-list-of-values/50682/2 "2025-04-14T12:30:40Z")

</div>

Hi&nbsp;[@Nicolas\_S](https://community.dynatrace.com/user/56040)

Yes, instead of listing each UID with contains(), you can use matchesValue() with wildcards if all your UIDs follow a common pattern.

For example:

```markup
fetch logs
| fieldsAdd warning = if(matchesValue(reqPath, "*UID*"), "warning", else:NULL)

```

This will add the “warning” tag to any log where the reqPath contains something like “UID”.

It’s much simpler and easier to maintain when you have many UIDs with a similar format.

Best regards!

---

<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:** [April 18, 2025, 8:37pm UTC](https://community.dynatrace.com/t/dql-fields-contains-list-of-values/50682/3 "2025-04-18T20:37:57Z")

</div>

More condensed version of such expressions (together with application example) looks like this:

```markup
data record(reqPath="aaaa UID1 bbbb"),
record(reqPath="aaaa UID2 bbbb"),
record(reqPath="aaaa UID3 bbbb"),
record(reqPath="aaaa UID4 bbbb"),
record(reqPath="aaaa UID5 bbbb")
| fieldsAdd warning=if(iAny(contains(reqPath, array("UID1","UID3","UID5")[])),"warning")

```

result:

 ![krzysztof_hoja_0-1745008658850.png](https://global.discourse-cdn.com/dynatrace/original/2X/d/dfab0fa71af223b4d6755fc931a27f7436005af2.png)

---

<div class="post-metadata">

**Author:** ![marco\_irmer](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marco_irmer/32/3038_2.png) [@marco\_irmer](https://community.dynatrace.com/u/marco_irmer)\
**Post date:** [April 18, 2025, 9:56pm UTC](https://community.dynatrace.com/t/dql-fields-contains-list-of-values/50682/4 "2025-04-18T21:56:18Z")

</div>

I would recommend using the [matchesPattern](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-query-language/functions/string-functions#matchesPattern) function for this scenario. This function allows you to test whether the field matches a specific [DPL](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-pattern-language) pattern.

---

<div class="post-metadata">

**Author:** ![Nicolas\_S](https://avatars.discourse-cdn.com/v4/letter/n/2bfe46/32.png) [@Nicolas\_S](https://community.dynatrace.com/u/Nicolas_S)\
**Post date:** [April 23, 2025, 7:43am UTC](https://community.dynatrace.com/t/dql-fields-contains-list-of-values/50682/5 "2025-04-23T07:43:12Z")

</div>

Hello,

Thank you that’s exactly what i was looking for.

The fields values are not UID1 UID2 and so on but real UID like 587a4b2c-9d3e-1f0g, a1b2-c3d4-e5f6-7890, etc which are very difficult to use with DPL or wildcards solutions.
