Parse String Values into Arrays Using Dynatrace DQL

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

Yes, it is possible and there are many option. Depending on how this array is represented in string, you can use:

or DPL JSON Data — Dynatrace Docs

or DPL Array — Dynatrace Docs

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

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) ?