Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

SWQL String Manipulation in a Custom Resource

$
0
0

I have the following query successfully working in a custom SWQL resource on a view:

 

SELECT MultiValueMessages FROM Orion.APM.ComponentAlert WHERE ComponentID = '90224'

 

 

The output is a string containing 4 custom message results fron a component monitor, and it looks like this:

ITSecurityOnCall:user1@mail.org, NetworkEngineersOnCall:user2@mail.org, SystemsEngineersOnCall:user3@mail.org, SystemsSpecialistsOnCall:user4@mail.org

 

This is progress, but we'd like to make it look more presentable. Something with line breaks would be very nice, although I don't see a way to do this with SWQL. I've tried the following syntax, and it does work in SWQL Studio, but does not work within my custom resource.

 

SELECT      ARRAYVALUEAT(SPLITSTRINGTOARRAY(REPLACE(MultiValueMessages,',','|§|§|')),0) AS ITSecurityOnCall,     ARRAYVALUEAT(SPLITSTRINGTOARRAY(REPLACE(MultiValueMessages,',','|§|§|')),1) AS NetworkEngineerOnCall,     ARRAYVALUEAT(SPLITSTRINGTOARRAY(REPLACE(MultiValueMessages,',','|§|§|')),2) AS SystemsEngineerOnCall,     ARRAYVALUEAT(SPLITSTRINGTOARRAY(REPLACE(MultiValueMessages,',','|§|§|')),3) AS SystemsSpecialistOnCall
FROM Orion.APM.ComponentAlert
WHERE ComponentID = '90224'

 

A simple REPLACE statement that inserts CHAR(10) and/or CHAR(13) would be nice, but SWQL does not support the CHAR statement. Any thoughts or suggestions?

 

TLDR: How can I manipulate strings from a component monitor's MultiValueMessages data in a custom SWQL resource/widget?


Viewing all articles
Browse latest Browse all 2677

Trending Articles