Skip to main content
Answer

Aggregates of synthetic timeseries on templates / datapointsWithGranularity

  • June 7, 2022
  • 2 replies
  • 109 views

Forum|alt.badge.img+4

Hi. How can I get aggregated values from synthetic timeseries fields on templates? Intuitively, I would expect the “datapointsWithGranularity” operator in the graphQL query to give me this, but I get the same results as for the “datapoints” operator. 

Should the aggregation type and granularity be part of the definition of the synthetic timeseries field in the template? If so, how?

 

Best answer by Emil Sandsto

Hi,

Unfortunately, there is no support for aggregating a synthetic timeseries in the TimeSeries API, which is the reason for the lack of support in Templates. For these types of use cases, I recommend creating a Cognite Function that generates a time series with the calculated result. In other words replicate the calculation that you do today in the synthetic query into Python code, and ingest that result into a time series you create.

I hope this helps!

2 replies

Anita Hæhre
Seasoned Practitioner
Forum|alt.badge.img+1
  • Head of Community
  • June 14, 2022

@Emil Sandsto 


  • Practitioner
  • Answer
  • June 14, 2022

Hi,

Unfortunately, there is no support for aggregating a synthetic timeseries in the TimeSeries API, which is the reason for the lack of support in Templates. For these types of use cases, I recommend creating a Cognite Function that generates a time series with the calculated result. In other words replicate the calculation that you do today in the synthetic query into Python code, and ingest that result into a time series you create.

I hope this helps!