Defines a single measure shown in a dashboard, report or reward, combining a reference to a MetricType (which knows how to calculate the value) with the entity, date range, caching and display settings for that measure. Instances are typically constructed with newMetricBuilder or QueryManager.newMetricBuilder and are persisted to XML under the element name "metric". QueryService.calcMetric resolves the entity from entitySelection, applies dateMode and any cacheConfig, and delegates the actual calculation to the MetricType named by metricTypeId.

Group: Queries

Implements: PortableId


Properties

PropertyReturnsDescription
appliesToSet<String>Identifiers for what this metric is used for, for example "reward-123", allowing a consumer to find metrics associated with a particular object.
cacheConfigMetricCacheConfigThe caching and pre-calculation configuration for this metric, if it was configured with a durationUnit.
dateModeDateModeHow the date range for this metric's calculation is derived, such as from the common date selector, a constant range, or relative to the previous period, year or quarter.
decimalsintThe number of decimal places the calculated value should be displayed with.
descriptionStringThe descriptive text for this metric, delegated to the description provided by its MetricType. This looks up the metric type by metricTypeId on every call, so it is not a simple field accessor.
endDateDateOptional. If provided this is used instead of standard query dates
entityAccountbooleanWhether this metric's entity selection is the whole account.
entityCurrentOrgbooleanWhether this metric's entity selection is the current org.
entityCurrentProfilebooleanWhether this metric's entity selection is the current profile.
entityNameStringThe name of the entity this metric applies to, used with the specifiedProfile and specifiedOrg entity selections.
entitySelectionEntitySelectionWhich entity this metric is calculated against, such as the whole account, the current profile or org, or a specifically named profile or org.
entitySpecifiedOrgbooleanWhether this metric's entity selection is a specifically named org, given by entityName.
entitySpecifiedProfilebooleanWhether this metric's entity selection is a specifically named profile, given by entityName.
iconStringThe icon shown alongside this metric, typically a font icon class name such as "fa-users".
idStringThe unique identifier of this metric, used to reference it from other configuration and as its portable id.
metricTypeIdStringThe id of the MetricType that calculates this metric's value.
notesStringFree text notes about this metric.
paramsMap<String,String>Additional parameters passed through to the metric type's calculation function.
startDateDateOptional. If provided this is used instead of standard query dates
titleStringThe display title of this metric.
unitStringThe unit label shown alongside this metric's value, such as "%" or "$".
unitPositionUnitPositionWhether the unit label is displayed before or after the value.

Methods

portableId() · getId() · getTitle() · getIcon() · getDecimals() · getDateMode() · getStartDate() · getEndDate() · getMetricTypeId() · getParams() · getNotes() · getEntityName() · getEntitySelection() · getAppliesTo() · isEntityAccount() · isEntityCurrentProfile() · isEntitySpecifiedProfile() · isEntitySpecifiedOrg() · isEntityCurrentOrg() · getDescription() · param(String name) · getUnit() · getUnitPosition() · getCacheConfig()

portableId()

Returns: String

The portable identifier for this metric, which is the same as getId.

getId()

Returns: String

The unique identifier of this metric, used to reference it from other configuration and as its portable id.

getTitle()

Returns: String

The display title of this metric.

getIcon()

Returns: String

The icon shown alongside this metric, typically a font icon class name such as "fa-users".

getDecimals()

Returns: int

The number of decimal places the calculated value should be displayed with.

getDateMode()

Returns: DateMode

How the date range for this metric's calculation is derived, such as from the common date selector, a constant range, or relative to the previous period, year or quarter.

getStartDate()

Returns: Date

Optional. If provided this is used instead of standard query dates

getEndDate()

Returns: Date

Optional. If provided this is used instead of standard query dates

getMetricTypeId()

Returns: String

The id of the MetricType that calculates this metric's value.

getParams()

Returns: Map<String,String>

Additional parameters passed through to the metric type's calculation function.

getNotes()

Returns: String

Free text notes about this metric.

getEntityName()

Returns: String

The name of the entity this metric applies to, used with the specifiedProfile and specifiedOrg entity selections.

getEntitySelection()

Returns: EntitySelection

Which entity this metric is calculated against, such as the whole account, the current profile or org, or a specifically named profile or org.

getAppliesTo()

Returns: Set<String>

Identifiers for what this metric is used for, for example "reward-123", allowing a consumer to find metrics associated with a particular object.

isEntityAccount()

Returns: boolean

Whether this metric's entity selection is the whole account.

isEntityCurrentProfile()

Returns: boolean

Whether this metric's entity selection is the current profile.

isEntitySpecifiedProfile()

Returns: boolean

Whether this metric's entity selection is a specifically named profile, given by entityName.

isEntitySpecifiedOrg()

Returns: boolean

Whether this metric's entity selection is a specifically named org, given by entityName.

isEntityCurrentOrg()

Returns: boolean

Whether this metric's entity selection is the current org.

getDescription()

Returns: String

The descriptive text for this metric, delegated to the description provided by its MetricType. This looks up the metric type by metricTypeId on every call, so it is not a simple field accessor.

param(String name)

Returns: String

Looks up a single named parameter value from this metric's params map.

ParameterDescription
namethe parameter name

getUnit()

Returns: String

The unit label shown alongside this metric's value, such as "%" or "$".

getUnitPosition()

Returns: UnitPosition

Whether the unit label is displayed before or after the value.

getCacheConfig()

Returns: MetricCacheConfig

The caching and pre-calculation configuration for this metric, if it was configured with a durationUnit.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.