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

Parsed Information from String to Array

Gib80
Participant

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 watchlist is a string not an array.

| sort arraySum(Watchlist) desc

Kind regards

3 REPLIES 3

krzysztof_hoja
Dynatrace Pro
Dynatrace Pro

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 Pro
Dynatrace Pro

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