What is a Timed Relation and how do we use it when creating a SimpleMetric?
A time relation is a means of expressing the fact that the relationship between two objects is in effect for a given period of time. For example, a customer may have multiple contracts with a retailer over time, with each contract having a start and end date.
If the metric path traverses a timed relation, the metric engine will implicitly enforce the time varying nature of the relationship. There is nothing you need to do.
You can also enforce Timed Relations in fetch requests. To perform a timed fetch, provide the following attributes in your fetch specification.
- asOf : datetime
- timeRange : TimeRange
Quick clarification… you can provide EITHER asOf OR timeRange.
When you specify ‘asOf’ you will get back the fetch as it looked like on the instant specified in the asOf field of the query
If you specify ‘timeRange’ you will get back all the fetches as they looked like between the start and end of your range.
Readers please note that as of at least v7.7.0,
FetchFilterSpec.timeRange is a private field for internal use only. Use