USP_KPIINSTANCE_CACHEDYNAMICGOALVALUE

Updates a KPI instance whose type uses a dynamic goal with a cached goal value. If the ID of a KPI instance whose type does not use a dynamic goal is specified, the KPI instance's value will remain unchanged.

Parameters

Parameter Parameter Type Mode Description
@KPIINSTANCEID uniqueidentifier IN
@GOALVALUE decimal(19, 5) IN
@CHANGEAGENTID uniqueidentifier IN

Definition

Copy


create procedure dbo.USP_KPIINSTANCE_CACHEDYNAMICGOALVALUE(@KPIINSTANCEID uniqueidentifier,
    @GOALVALUE decimal(19, 5),
    @CHANGEAGENTID uniqueidentifier)
as
    set nocount on;

    -- Only update the specified KPI instance if its goal value is dynamic.

    update dbo.KPIINSTANCE set GOALVALUE = @GOALVALUE,
        CHANGEDBYID = @CHANGEAGENTID,
        DATECHANGED = getdate()
    where ID = @KPIINSTANCEID
        and exists (select ID from dbo.KPICATALOG where KPICATALOG.GOALRETRIEVALTYPECODE = 1 
            and KPICATALOG.ID = KPIINSTANCE.KPICATALOGID);