Skip to main content
10-Marble
May 19, 2025
Solved

How to Average an Infotable Value

  • May 19, 2025
  • 2 replies
  • 616 views

I have an output from my SQL database saved as an InfoTable in ThingWorx (I've already filtered the timestamp before extracting it). How can I average all of the data in my InfoTable? I couldn't find a way to extract the data into an array (if that's even possible).

Best answer by Rocko

You could try something like this:

var params = { t: myInfoTable, columns: "Quantity, Age", aggregates: "AVERAGE"};
var result = Resources["InfoTableFunctions"].Aggregate(params);

 

You might also want to check https://community.ptc.com/t5/IoT-Connectivity-Tips/Getting-to-Know-InfoTables-pdf/ta-p/818843

 

 

 

2 replies

Rocko
Rocko19-TanzaniteAnswer
19-Tanzanite
May 19, 2025

You could try something like this:

var params = { t: myInfoTable, columns: "Quantity, Age", aggregates: "AVERAGE"};
var result = Resources["InfoTableFunctions"].Aggregate(params);

 

You might also want to check https://community.ptc.com/t5/IoT-Connectivity-Tips/Getting-to-Know-InfoTables-pdf/ta-p/818843

 

 

 

16-Pearl
June 9, 2025

Hi @AF_01_10333884 ,

It appears that there is a reply that answers your question.  For the benefit of other Community Members who may have the same question, it would be great if you could designate it as the Accepted Solution.

In the event that this response did not answer your question, please post your current status so that we can continue to support.

Thanks for using the PTC Community!

Regards,


Charles

1-Visitor
May 22, 2025

Just a thought: Could you let the database produce an average for you?

dgg