KPIINSTANCESTATUSHISTORY

Contains a history of the values and the threshold values for a given KPI instance.

Primary Key

Primary Key Field Type
ID uniqueidentifier

Fields

Field Field Type Null Notes Description
CURRENTVALUE decimal(20, 5) Default = 0 Current value for the KPI.
PREVIOUSVALUE decimal(20, 5) Default = 0 Previous value for the KPI.
ASOFDATE datetimeoffset yes
PREVIOUSSTATUSCODE tinyint Default = 0 0=Red, 1=Yellow, 2=Green
PREVIOUSSTATUS nvarchar(6) (Computed) yes CASE [PREVIOUSSTATUSCODE] WHEN 0 THEN N'Red' WHEN 1 THEN N'Yellow' WHEN 2 THEN N'Green' END Provides a translation for the 'PREVIOUSSTATUSCODE' field.
CURRENTSTATUSCODE tinyint Default = 0 0=Red, 1=Yellow, 2=Green
CURRENTSTATUS nvarchar(6) (Computed) yes CASE [CURRENTSTATUSCODE] WHEN 0 THEN N'Red' WHEN 1 THEN N'Yellow' WHEN 2 THEN N'Green' END Provides a translation for the 'CURRENTSTATUSCODE' field.
GOALAIMTYPECODE tinyint Default = 0 The direction in which the trend should ideally go.
GOALAIMTYPE nvarchar(4) (Computed) yes CASE [GOALAIMTYPECODE] WHEN 0 THEN N'Up' WHEN 1 THEN N'Down' END Provides a translation for the 'GOALAIMTYPECODE' field.
GOALUPWARDLOWVALUE decimal(20, 4) Default = 0
GOALUPWARDMIDVALUE decimal(20, 4) Default = 0
GOALDOWNWARDMIDVALUE decimal(20, 4) Default = 0
GOALDOWNWARDHIGHVALUE decimal(20, 4) Default = 0
DATEADDED datetime Default = getdate() Indicates the date this record was added.
DATECHANGED datetime Default = getdate() Indicates the date this record was last changed.
TS timestamp Timestamp.
TSLONG bigint (Computed) yes CONVERT(bigint, TS) Numeric representation of the timestamp.

Foreign Keys

Foreign Key Field Type Null Notes Description
KPIINSTANCEID uniqueidentifier KPIINSTANCE.ID KPI instance to which the value belongs.
ADDEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.
CHANGEDBYID uniqueidentifier CHANGEAGENT.ID FK to CHANGEAGENT.

Indexes

Index Name Fields Unique Primary Clustered
IX_KPIINSTANCESTATUSHISTORY_DATEADDED DATEADDED yes
IX_KPIINSTANCESTATUSHISTORY_DATECHANGED DATECHANGED
IX_KPIINSTANCESTATUSHISTORY_KPIINSTANCEID KPIINSTANCEID
PK_KPIINSTANCESTATUSHISTORY ID yes yes

Triggers

Trigger Name Description
TR_KPIINSTANCESTATUSHISTORY_AUDIT_UPDATE
TR_KPIINSTANCESTATUSHISTORY_AUDIT_DELETE