# How to add a second condition when using replaceString() function?

**URL:** <https://community.dynatrace.com/t/how-to-add-a-second-condition-when-using-replacestring-function/47497>\
**Category:** DQL\
**Tags:** dql, dynatrace-managed, notebooks, dpl, logs\
**Created:** [September 5, 2024, 11:53am UTC](https://community.dynatrace.com/t/how-to-add-a-second-condition-when-using-replacestring-function/47497 "2024-09-05T11:53:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![badgerfifteen](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@badgerfifteen](https://community.dynatrace.com/u/badgerfifteen)\
**Post date:** [September 5, 2024, 11:53am UTC](https://community.dynatrace.com/t/how-to-add-a-second-condition-when-using-replacestring-function/47497/1 "2024-09-05T11:53:06Z")

</div>

Hi I am currently using the replaceString() function to replace some values in a DQL query. How do I specify a second piece of text to be filtered?

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [September 6, 2024, 1:57am UTC](https://community.dynatrace.com/t/how-to-add-a-second-condition-when-using-replacestring-function/47497/2 "2024-09-06T01:57:32Z")

</div>

There is an example in the docs , is this what you are after ?

> **[String functions](https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/functions/string-functions)**
>
> A list of DQL string functions.

```markup
data record(content = "DQL is awesome!"),
     record(content = "Dynatrace Query Language"),
     record(content = "abcabca")
| fieldsAdd replaceString(content, "awesome", "simple"),
            replaceString(content, "abca", "xyz")

```

---

<div class="post-metadata">

**Author:** ![Kaladhar](https://avatars.discourse-cdn.com/v4/letter/k/258eb7/32.png) [@Kaladhar](https://community.dynatrace.com/u/Kaladhar)\
**Post date:** [May 12, 2025, 7:53pm UTC](https://community.dynatrace.com/t/how-to-add-a-second-condition-when-using-replacestring-function/47497/3 "2025-05-12T19:53:11Z")

</div>

Did you figure out the solution for this ??

I have the similar requirement with the&nbsp;expression(where substrings should be replaced) is having two different&nbsp;substrings.

For Ex: Category field has two results either A or B and I want to replace ‘A’ with ‘XML’ and ‘B’ with ‘TEXT’. I used below command and it worked for A. How do I replace the&nbsp; the another string B in the same&nbsp;Category field(without adding new&nbsp;fieldsAdd command.)

fieldsAdd replaceString(Category, “A”, “XML”)

Thanks,
