hidden deprecatedpersistent class %iKnow.Metrics.Metric
extends %Persistent
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 represents custom metric definitions in your iKnow domain, which express
a particular metric of interest for your applications. If you are manually setting
individual values, you can instantiate and work with this class directly as follows:
- Create a Metric object using %New and save it using
%Save
- Register one or more target types using
AddTargetType
- Set and retrieve individual values using
GetValue and SetValue.
Please refer to %iKnow.Metrics.MetricDefinition for a more declarative
way of defining and managing custom metrics. and %iKnow.Metrics.MetricBuilder
for more coordinated ways to calculate metric values. Using this class directly is not
recommended.
See also %iKnow.Metrics.MetricAPI for more functionality and queries.
property BuilderClass
as %String;
property DefinitionClass
as %String [ ReadOnly ];
property Description
as %String(MAXLEN=500);
property DomainId
as %Integer [ ReadOnly ];
property GroupField
as %String;
property MaintainIndex
as %Boolean;
property MetricId
as %Integer [ ReadOnly ];
property Name
as %String [ Required,ReadOnly ];
property Type
as %String(VALUELIST=",domain,source,group") [ InitialExpression = $$$IKMTRTYPEDOMAIN,Required,ReadOnly ];
method BuildIndices()
as %Status
Builds all indices for target types supported by this metric.
method ClearValues(pTargets As %List = "")
as %Status
Erases any existing values for this metric, optionally restricted to a particular (set of)
targets.
method GetValue(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).
When Type '= $$$IKMTRTYPEDOMAIN, pContext is mandatory
and should be a source ID for $$$IKMTRTYPESOURCE or a metadata value for $$$IKMTRTYPEGROUP.
method SetValue(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.
When Type '= $$$IKMTRTYPEDOMAIN, pContext is mandatory
and should be a source ID for $$$IKMTRTYPESOURCE or a metadata value for $$$IKMTRTYPEGROUP.
index (NameIndex on DomainId,Name) [Unique];
index (PKINDEX on DomainId,MetricId) [IdKey,PrimaryKey,Unique];