Class Reference
IRIS for UNIX 2019.3
InterSystems: The power behind what matters   
Documentation  Search
  [ENSLIB] >  [%DeepSee] >  [KPI]
Private  Storage   

abstract class %DeepSee.KPI extends %DeepSee.AbstractKPI

Subclasses of this class are used to define KPIs (key performance indicators). A KPI defines a set of related values that can be used to drive widgets on a DeepSee dashboard.
A KPI can define a set of actions that can be called from control buttons on a dashboard widget.
Each KPI class is also also a %CSP page; if you view it as a Web Page, you can view a test page for the KPI (you must hold Developer privileges to do this).

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
3 46


Summary

Properties
%filterValues %fromCache %id %message
%rangeLower %rangeUpper %seriesCount %seriesNames
%source %thresholdLower %thresholdUpper

Methods
%AddToSaveSet %CheckResource %ClassIsLatestVersion %ClassName
%ClearKPICache %ComputeKPICacheKey %ComputeKPITimestamp %ConstructClone
%CreateKPIController %CreateModelInstance %DeleteModel %DispatchClassMethod
%DispatchGetModified %DispatchMethod %DispatchSetModified %DispatchSetMultidimProperty
%Extends %GetFilterDisplayValue %GetFilterKey %GetFilterLogicalValue
%GetJSValidationCode %GetKPICaption %GetKPICaptionName %GetKPIClassTimeStamp
%GetKPIName %GetKPIPropertyCaption %GetKPIValue %GetKPIValueArray
%GetMDXContextFilter %GetMDXForFilter %GetMDXText %GetMembersForFilter
%GetParameter %GetPropertyInfo %GetSQLForFilter %GetSQLText
%GetSourceType %InvokeAction %IsA %IsAsync
%IsCacheable %IsModified %IsPublic %IsReadOnly
%LoadKPIFromCache %New %NormalizeObject %ObjectModified
%OnComputeKPITimestamp %OnCopyDataFromModel %OnCopyDataToModel %OnDashboardAction
%OnDeleteModel %OnDeleteSource %OnExecute %OnGetActionList
%OnGetFilterList %OnGetFilterMembers %OnGetKPICaption %OnGetKPIPropertyInfo
%OnGetListingResultSet %OnGetListingSQL %OnGetMDX %OnGetPropertyInfo
%OnGetSQL %OnInvokeAction %OnLoadKPI %OnLoadKPIFromCache
%OnLoadModel %OnNewSource %OnOpenSource %OnSaveKPIToCache
%OnSaveSource %OnStoreModel %OnSubmit %OpenModel
%OriginalNamespace %PackageName %PrintValue %RemoveFromSaveSet
%SaveKPIToCache %SaveModel %SerializeObject %SetModified
%SetPercentComplete %SubmitHandler %TestKPICache %ValidateKPICache
%ValidateObject ConvertParameter Decrypt Encrypt
EscapeHTML EscapeURL HyperEventCall HyperEventHead
Include InsertHiddenField InsertHiddenFields IsPrivate
Link OnHTTPHeader OnPage OnPageError
OnPostHTTP OnPostHyperEvent OnPreHTTP OnPreHyperEvent
Page QuoteJS RewriteURL ShowError
StartTimer StopTimer ThrowError UnescapeHTML
UnescapeURL

Subclasses
%DeepSee.KPIPlugIn %iKnow.DeepSee.BaseKPI Ens.DeepSee.ActivityVolumeAndDurationKPI

Parameters

• parameter ASYNC = 0;
If true, then this KPI can be executed asychronously.
• parameter CACHEABLE = 0;
If true, then results for this KPI can be cached.
• parameter LABELCONCAT = "/";
For MDX-based KPIs, use this character when concatenating labels for nested rows.

Methods

• final method %ComputeKPICacheKey(pSourceType As %String, pQueryText As %String = "") as %Status
Compute the kpi cache key for the current KPI result. Place the result in %cacheKey.
• final method %ComputeKPITimestamp(Output pTimestamp As %String, pSourceType As %String, pQueryText As %String = "") as %String
Compute the kpi cache timestamp for the current KPI result.
• classmethod %GetKPICaptionName(pName As %String = "") as %String
Return the caption as defined in the XML for this KPI.
• classmethod %GetKPIName(pName As %String = "") as %String
Return the logical name for this KPI.
• method %GetMDXContextFilter() as %String
Return a series of %FILTER clauses (as a single string) based on the "%CONTEXT" of the %KPI or %MDX function that invoked this KPI. This behavior is automatic; you can override this method and return "" if you do not want this to happen.
• method %GetMDXForFilter(pLevelSpec As %String, pFilterName As %String) as %String
Given a filter name, pFilterName, and a level specification, pLevelSpec, return an MDX expression based on the filter value(s) that can be used within an MDX WHERE or %FILTER clause.
Returns "" if there is no filter value.
For example: if you have a MDX-based KPI class with a YearSold level within a DateOfSale dimension and a filter named Year, you can get an MDX filter expression for it:
Set tYearFilter = ..%GetMDXForFilter("[DateOfSale].[YearSold]","Year")
If tYearFilter is not "", then you can add it to your MDX query to add the filtering:
Set tMDX = tMDX _ " %FILTER " _ tYearFilter
• final classmethod %GetMDXText() as %String
Return the default MDX statement for this KPI.
• classmethod %GetMembersForFilter(pCube As %String, pFilterSpec As %String, Output pMembers, pSearchKey As %String = "") as %Status
Convenience method. For a given DeepSee cube and filter spec, return a list of members in the form:
pMembers(n)=$LB(text,value)
This list contains both the display names (text) of the filter items and the logical names (value).
pCube is the logical name of the cube with .cube appended, for example: "holefoods.cube"
pFilterSpec is the COMPLETE name of a level within the cube:
"[DateOfSale].[Actual].[YearSold]"
pSearchKey is any search text entered by the user.
• method %GetSQLForFilter(pFieldName As %String, pFilterName As %String) as %String
Given a filter name, pFilterName, and an SQL field name, pFieldName, return an SQL expression based on the filter value(s) that can be used within an SQL WHERE clause. Returns "" if there is no filter value.
For example: if you have a SQL-based KPI class based on a table with a YearSold field, you can get an SQL expression for it:
Set tYearExpr = ..%GetSQLForFilter("YearSold","Year")
If tYearExpr is not "", then you can add it to your SQL WHERE clause to add the filtering:
Set tSQL = tSQL _ " WHERE " _ tYearExpr
or if your query already has a WHERE clause:
Set tSQL = tSQL _ " AND " _ tYearExpr
• final classmethod %GetSQLText() as %String
Return the default SQL statement for this KPI.
• classmethod %GetSourceType() as %String
Return the sourceType for this KPI
• classmethod %IsAsync() as %Boolean
Return true if this kpi can be computed asynchronously.
• classmethod %IsCacheable() as %String
Return true if this KPI can interact with the cache.
• final method %LoadKPIFromCache() as %Status
Load this KPI from cached data.
• method %OnComputeKPITimestamp(ByRef pTimestamp As %String, pSourceType As %String, pQueryText As %String = "") as %Status
Compute and return the KPI cache timestamp for the current KPI result. Typically this is the timestamp of the cube this KPI depends on.
• method %OnExecute() as %Status
Get data for this KPI manually. This is implemented by subclasses that provide manual data.
• classmethod %OnGetFilterList(Output pFilters As %List, pDataSourceName As %String = "") as %Status
Callback to get additional possible filters for this KPI. This drives the list of filter selections for widget connected to this KPI. This takes the form:
pFilters($I(pFilters))=$LB(name,caption,value,multiSelect)
• classmethod %OnGetKPIPropertyInfo(ByRef pList As %String, pPropNo As %Integer, pModelId As %String = "") as %Status
Add additional properties beyond those defined in the KPI block. This takes the form:
pList(n) = name
pList(n,"defaultValue") = value
pList(n,"columnNo") = #
pPropNo is the number of next open slot in the list.
• classmethod %OnGetListingResultSet(ByRef pFilters As %String, ByRef pSelection As %String, pListingName As %String = "", Output pRS As %SQL.StatementResult) as %Status
This callback, if implemented, can prepare and execute a listing query used to provide a "detail listing" for this KPI. pFilters is an array of current filter values.
pListingName is the name of the listing to display. This is reserved for future use.
• classmethod %OnGetListingSQL(ByRef pFilters As %String, ByRef pSelection As %String, pListingName As %String = "") as %String
This callback, if implemented, returns the text of an SQL query used to provide a "detail listing" for this KPI.
pFilters is an array of current filter values: pFilters(name)=value.
pSelection is an array containing information about the current selected items in the pivot. It contains several values:
pSelection("selectedRange") contains the current selected cells in the pivot as a string in the form "startRow,startCol,endRow,endCol" (1-based). "" if no cells are selected.
pSelection("rowValues") contains a csv-list of "row" values for the selected rows in the pivot (similar to the $$$VALUELIST value used for OpenWindow URLs. This may contain "\," for "," within the data values.
pSelection("sortColumn") is the number of the column to sort on (or 0 for no sort).
pSelection("sortDir") is the sort direction ("ASC" or "DESC").
pListingName is the name of the listing to display. This is reserved for future use.
This method is simply a convenient alternative to the %OnGetListingResultSet method. It takes precedence over the %OnGetListingResultSet method.
• method %OnGetMDX(ByRef pMDX As %String) as %Status
This callback, if implemented, lets a subclass provide an MDX statement to fetch data for this KPI. If there are filter values, they will be within the %filterValues property (an object).
• method %OnGetSQL(ByRef pSQL As %String) as %Status
This callback, if implemented, lets a subclass provide an SQL statement to fetch data for this KPI. If there are filter values, they will be within the %filterValues property (an object).
• method %OnLoadKPIFromCache() as %Status
Notification that we are loading this KPI from cached data.
• final method %OnLoadModel(pSource As %RegisteredObject) as %Status
This callback method does the actual work of loading values from the source object.
• method %OnSaveKPIToCache() as %Status
Notification that we are saving this KPI to the cache.
• final method %SaveKPIToCache(pSourceType As %String, pQueryText As %String = "") as %Status
Save this KPI to the KPI cache.
• final method %SetPercentComplete(pPctComplete As %Integer, pErrorCode As %Status = "") as %Status
For a KPI running in the background, set the percentage complete.
• final method %TestKPICache(Output pIsCached As %Boolean, pSourceType As %String, pQueryText As %String = "") as %Status
Test if this KPI has cached data.
• final method %ValidateKPICache(pSourceType As %String, pQueryText As %String = "") as %Status
Test if the data cached for this KPI is up-to-date. If not, clear the cached data.


Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.