DQL
Questions about Dynatrace Query Language
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Parse String Values into Arrays Using Dynatrace DQL

Gib80
Contributor

Summary: This thread shows how to parse string data into array structures in DQL. It includes examples of splitting fields and working with the resulting array elements.



Good Afternoon,

Is it possible to convert a string from a parsed command to an array?

This is the parsed command I have.  

| parse event.original, """LD 'watchlist":' LD:Watchlist ',' """

I wish to use the sort command below, but it states that watchlist is a string, not an array.

| sort arraySum(Watchlist) desc

Kind regards

3 REPLIES 3

krzysztof_hoja
Dynatrace Champion
Dynatrace Champion

Yes, it is possible and there are many option. Depending on how this array is represented in string, you can use:
https://docs.dynatrace.com/docs/platform/grail/dynatrace-query-language/functions/string-functions#s...
or https://docs.dynatrace.com/docs/platform/grail/dynatrace-pattern-language/log-processing-json-array

or https://docs.dynatrace.com/docs/platform/grail/dynatrace-pattern-language/log-processing-array

To advice more precisely example of original filed value would be helpful. 

Hi krzysztof_hoja,

The filed value returned from the watchlist parsed command above is  "S_PEP"

Kind regards

Preview
 
 
 

krzysztof_hoja
Dynatrace Champion
Dynatrace Champion

If it is "S_PEP" (not a number), how do you want to calculate "arraySum(Watchlist)" ?

Or maybe you want to order records alphabetically (| sort Watchlist) ?

Featured Posts