04 Oct 2024 12:34 PM
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
05 Oct 2024 12:25 PM
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.
07 Oct 2024 08:14 AM
Hi krzysztof_hoja,
The filed value returned from the watchlist parsed command above is "S_PEP"
Kind regards
07 Oct 2024 02:45 PM
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) ?