cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

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?

2 REPLIES 2

p_devulapalli
Leader

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

https://docs.dynatrace.com/docs/shortlink/string-functions#replaceString

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

Kaladhar
Frequent Guest

Did you figure out the solution for this ??

I have the similar requirement with the expression(where substrings should be replaced) is having two different 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  the another string B in the same Category field(without adding new fieldsAdd command.)

fieldsAdd replaceString(Category, "A", "XML")

 

Thanks,

Featured Posts