Skip to main content
1-Visitor
August 27, 2019
Question

Beginner question: how to query some data and apply a little math?

  • August 27, 2019
  • 1 reply
  • 1006 views

Hi. Still learning ThingWorx so bear with me. I managed to log some live property data with a ValueStream using an Influx persistence provider. And showing it on a LED/Guage in a mashup. So far so good, cool stuff.

 

But what now, if I would like to apply some math to the property values to e.g. calculate output over the last 5 minutes. Can I write custom queries to InfluxDb, or must everything go through the ValueStream for mashups?

 

What's the recommended approach?

1 reply

18-Opal
August 27, 2019

Hello,

 

Here's a month-old article, which suggests that you can't do native InfluxDB aggregations just yet. It also offers some workarounds, e.g. using InfluxDB's REST endpoints.

 

On a side note, one of the methods we used successfully in the past (before InfluxDB) is pre-aggregating data at the time of ingestion, i.e. store running totals / averages / etc. Depending on your use case it might have dramatic effect on performance at the expense of overall database size and additional code complexity.

 

Regards,

Constantine