Skip to main content

%iKnow.Metrics.MetricAPI

deprecated class %iKnow.Metrics.MetricAPI extends %iKnow.Queries.AbstractAPI

The %iKnow.Metrics infrastructure is deprecated in favour of the more SQL-oriented approach offered through %iKnow.Tables.Utils, where you can add computed fields at different levels and choose whether they need to be persisted or not.

This class offers a number of API methods to interact with any custom metrics registered in a particular domain. Use %iKnow.Metrics.MetricDefinition to configure any custom metric properties, eventually referring a %iKnow.Metrics.MetricsBuilder implementation for applicable calculations and then consult the results through the different methods in this interface.

Method Inventory

Parameters

parameter GetMetricsRT = metricId:%Integer,name:%String,description:%String,type:%String,definitionClass:%String,builderClass:%String,groupField:%String;
parameter GetTargetsRT = targetType:%String;
parameter GetTopRT = targetId:%Integer,targetValue:%String,score:%Numeric,targetType:%String;

Methods

classmethod ClearValues(pDomainId As %Integer, pMetricId As %Integer, pTargets As %List = "") as %Status
Drops all metric values for metric pMetricId in domain pDomainId. This can optionally be limited to one or more target types using pTargets. If pTargets is "" (default), values for all targets registered for this metric will be dropped.
classmethod GetMetricId(pDomainId As %Integer, pMetricName As %Integer, Output pSC As %Status) as %Integer
Returns the ID corresponding to the supplied metric name for this domain.
classmethod GetMetrics(ByRef pResult, pDomainId As %Integer) as %Status
Returns all the metrics registered in this domain.
classmethod GetTargets(ByRef pResult, pDomainId As %Integer, pMetricId As %Integer) as %Status
Returns all the target types registered for a given metric.
classmethod GetTop(ByRef pResult, pDomainId As %Integer, pMetricId As %Integer, pPage As %Integer = 1, pPageSize As %Integer = 10, pContext As %String = "", pTargetType As %String = "") as %Status

Returns the elements with the highest values for custom metric pMetricId, optionally restricted to the target type pTargetType.

pContext is ignored when the metric is type $$$IKMTRTYPEDOMAIN and should be a source ID for $$$IKMTRTYPESOURCE or a metadata value for $$$IKMTRTYPEGROUP. In the latter case, pContext is optional and the top entries for all metadata values will be returned if left blank.

classmethod GetValue(pDomainId As %Integer, pMetricId As %Integer, pTargetType As %String, pTargetId As %Integer, pContext As %String = "") as %Numeric

Returns the value of a particular target element identified by pTargetId (for example, when pTargetType = $$$IKMTRENTITY, pTargetId is a unique entity ID).

pContext is only required when the metric is not of type $$$IKMTRTYPEDOMAIN and should be a source ID for $$$IKMTRTYPESOURCE or a metadata value for $$$IKMTRTYPEGROUP.

classmethod SetValue(pDomainId As %Integer, pMetricId As %Integer, pTargetType As %String, pTargetId As %Integer, pValue As %Integer, pContext As %String = "") as %Status

Sets the value of a particular target element identified by pTargetId (for example, when pTargetType = $$$IKMTRENTITY, pTargetId is a unique entity ID) to pValue.

pContext is only required when the metric is not of type $$$IKMTRTYPEDOMAIN and should be a source ID for $$$IKMTRTYPESOURCE or a metadata value for $$$IKMTRTYPEGROUP.

Inherited Members

Inherited Methods

FeedbackOpens in a new tab