MetricDimensionHandler
MetricDimensionHandler = (
event,dimension,ctx) =>Promise<ReadItem|string|undefined>
Resolves the Dimension value of one Event.
Parameters
Section titled “Parameters”Event being projected.
dimension
Section titled “dimension”Dimension being resolved.
Read context for looking up Items.
Returns
Section titled “Returns”Promise<ReadItem | string | undefined>
The Dimension Item, its UUID, or undefined.
Remarks
Section titled “Remarks”Return the Item that is the Dimension value, for example the country Item for a Dimension on the
country Template. When the value is not an Item, return its identifier as a string; the string
must be a UUID because Dimension values are stored in UUID columns. Return undefined when the
Event has no value for the Dimension. A handler that throws or returns a non-UUID string is
stored as having no value, and the Event is still projected.
Example
Section titled “Example”Resolving a Dimension from a Relation
const momentDimensionHandler: MetricDimensionHandler = async (event, _dimension, ctx) => { const automation = await ctx.getItem(event.itemId); if (!automation) return undefined; return await automation.relations.moment.get();};
