Submit a ticketCall us

AnnouncementsAre You “Flying Blind?”

When it comes to your complex IT infrastructure, you want to ensure you have a good grasp of what’s going on to avoid any fire drills that result from guesswork. Read our white paper to learn how proactively monitoring your IT environment can help your organization while giving you peace of mind.

Get your free white paper.

Home > Success Center > Server & Application Monitor (SAM) > SAM - Knowledgebase Articles > Pull individual numeric values from a multi-value script

Pull individual numeric values from a multi-value script

Overview

You want to pull individual numeric values from a multi-value script.

Environment

All SAM versions

Resolution

The following function works for numeric data:

CREATE FUNCTION [dbo].[apm_Custom_GetMultiValueCurrentnumericdata] (
       @ComponentID int,
       @RowNumber int
 )
 RETURNS nvarchar(max)
 AS
 BEGIN
       DECLARE @result nvarchar(max)
       SELECT @result = Temp.NumericData FROM
       (
             SELECT RANK() OVER (ORDER BY DynEvDef.ID) AS Row, DynEvData.NumericData
             FROM dbo.APM_DynamicEvidence_DetailData AS DynEvData
             INNER JOIN dbo.APM_CurrentComponentStatus AS CCS
                 ON CCS.ComponentStatusID = DynEvData.ComponentStatusID
             INNER JOIN dbo.APM_DynamicEvidenceColumnSchema AS DynEvDef
                 ON DynEvDef.ID = DynEvData.ColumnSchemaID
             WHERE DynEvDef.[Type] = 1 AND CCS.ComponentID = @ComponentID
       ) Temp
       WHERE Temp.Row = @RowNumber
       RETURN @result
 END

At this point, you can use the following inline SQL macro in the Alert Manager to get the first value

${SQL:select dbo.apm_Custom_GetMultiValueCurrentnumericdata(${ComponentId}, 1)}

 

 

Last modified

Tags

Classifications

Public