Submit a ticketCall us

Webinar: Web Help Desk for HR, Facilities and Accounting Departments
This webinar will focus on use cases for HR, Facilities and Accounting.

Having a unified ticketing and asset management system for all the departments in your company can provide end-users with a seamless experience and make things easier for your IT team. Yet, with different business tasks and objectives, many departments don’t fully understand the capabilities of Web Help Desk and how the software can be customized for effective use in their departments.
Register Now.

Home > Success Center > Server & Application Monitor (SAM) > 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
21:36, 30 Nov 2016

Tags

Classifications

Public