Calculate Metric Values Using Ontology Functions
You can create metric instances (and populate their fields) using certain ontology functions in rules or rule functions.
The ontology functions for creating metric instances:
Advanced users familiar with XSLT Mapper may prefer working in that interface.
To understand how fields that use complex aggregation types are computed, see Complex Aggregation Types with Auxiliary Fields.
To ensure that a metric can receive data from an entity, ensure that your rule has the entity in its scope and set any necessary conditions.
Using the Compute Function
The arguments of the compute function are the metric fields, including tracking fields. To see the function arguments, open the Ontology Function catalog, or view the tooltip for the metric’s compute function when configuring it in the rule editor.
Here is a sample rule with the compute function ensuring that the metric receives data from the Ticker event:
rule Rules.onTicker { attribute { priority = 5; forwardChain = true; } declare { Events.Ticker ticker; } when { } then { //compute the M_Ticker metric Dashboards.M_TickerTracker tickerTracker = Dashboards.M_TickerTracker.compute(ticker.ticker,ticker.price,ticker.volume);