This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Home > Class Reference > %SYS namespace > %iKnow.Metrics.Metric

%iKnow.Metrics.Metric

SQL Table Name: %iKnow_Metrics.Metric

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:

  1. Create a Metric object using %New() and save it using %Save()
  2. Register one or more target types using AddTargetType()
  3. 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 Inventory (Including Private)

Method Inventory (Including Private)

Properties (Including Private)

property BuilderClass as %String;
Property methods: BuilderClassDisplayToLogical(), BuilderClassGet(), BuilderClassIsValid(), BuilderClassLogicalToDisplay(), BuilderClassLogicalToOdbc(), BuilderClassNormalize(), BuilderClassSet()
property DefinitionClass as %String [ ReadOnly ];
Property methods: DefinitionClassDisplayToLogical(), DefinitionClassGet(), DefinitionClassIsValid(), DefinitionClassLogicalToDisplay(), DefinitionClassLogicalToOdbc(), DefinitionClassNormalize()
property Description as %String (MAXLEN = 500);
Property methods: DescriptionDisplayToLogical(), DescriptionGet(), DescriptionIsValid(), DescriptionLogicalToDisplay(), DescriptionLogicalToOdbc(), DescriptionNormalize(), DescriptionSet()
property DomainId as %Integer [ Required , ReadOnly ];
Property methods: DomainIdDisplayToLogical(), DomainIdGet(), DomainIdIsValid(), DomainIdLogicalToDisplay(), DomainIdNormalize()
property GroupField as %String;
Property methods: GroupFieldDisplayToLogical(), GroupFieldGet(), GroupFieldIsValid(), GroupFieldLogicalToDisplay(), GroupFieldLogicalToOdbc(), GroupFieldNormalize(), GroupFieldSet()
property MaintainIndex as %Boolean;
Property methods: MaintainIndexDisplayToLogical(), MaintainIndexGet(), MaintainIndexIsValid(), MaintainIndexLogicalToDisplay(), MaintainIndexNormalize(), MaintainIndexSet()
property MetricId as %Integer [ Required , ReadOnly ];
Property methods: MetricIdDisplayToLogical(), MetricIdGet(), MetricIdIsValid(), MetricIdLogicalToDisplay(), MetricIdNormalize()
property Name as %String [ Required , ReadOnly ];
Property methods: NameDisplayToLogical(), NameGet(), NameIndexCheck(), NameIndexCheckUnique(), NameIndexDelete(), NameIndexExists(), NameIndexOpen(), NameIndexSQLCheckUnique(), NameIndexSQLExists(), NameIndexSQLFindPKeyByConstraint(), NameIndexSQLFindRowIDByConstraint(), NameIsValid(), NameLogicalToDisplay(), NameLogicalToOdbc(), NameNormalize()
property Type as %String (VALUELIST = ",domain,source,group") [ InitialExpression = $$$IKMTRTYPEDOMAIN , Required , ReadOnly ];
Property methods: TypeDisplayToLogical(), TypeGet(), TypeIsValid(), TypeLogicalToDisplay(), TypeLogicalToOdbc(), TypeNormalize()

Methods (Including Private)

private method %OnBeforeSave(insert As %Boolean) as %Status
Inherited description: This callback method is invoked by the %Save() method to provide notification that the object is being saved. It is called before any data is written to disk.

insert will be set to 1 if this object is being saved for the first time.

If this method returns an error then the call to %Save() will fail.

private classmethod %OnDelete(oid As %ObjectIdentity) as %Status
Inherited description: This callback method is invoked by the %Delete() method to provide notification that the object specified by oid is being deleted.

If this method returns an error then the object will not be deleted.

private method %OnNew(pDomainId As %Integer, pName As %String, pType As %String, pDefinitionClass As %String) as %Status
Inherited description: This callback method is invoked by the %New() method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

private method %OnValidateObject(force As %Integer) as %Status
This callback method is invoked by the %ValidateObject() method to provide notification that the current object is being validated.

If this method returns an error then %ValidateObject() will fail.

method BuildIndices() as %Status
Builds all indices for target types supported by this metric.
private classmethod BuilderClassIsValid(pBuilderClass As %String) as %Status
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.

private classmethod NameIsValid(pName As %String) as %Status
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.

Indexes

index (NameIndex on DomainId,Name) [Unique];
Index methods: NameIndexCheck(), NameIndexCheckUnique(), NameIndexDelete(), NameIndexExists(), NameIndexOpen(), NameIndexSQLCheckUnique(), NameIndexSQLExists(), NameIndexSQLFindPKeyByConstraint(), NameIndexSQLFindRowIDByConstraint()
index (PKINDEX on DomainId,MetricId) [IdKey, PrimaryKey, Type = key, Unique];
Index methods: PKINDEXCheck(), PKINDEXDelete(), PKINDEXExists(), PKINDEXOpen(), PKINDEXSQLCheckUnique(), PKINDEXSQLExists(), PKINDEXSQLFindPKeyByConstraint(), PKINDEXSQLFindRowIDByConstraint()

Inherited Members

Inherited Methods (Including Private)

Storage

Storage Model: CacheSQLStorage

Maps: 2