Home > Class Reference > ENSLIB namespace > %DeepSee.KPI

%DeepSee.KPI

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).

Method Inventory (Including Private)

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 (Including Private)

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 co