cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

ThingWorx Navigate is now Windchill Navigate Learn More

Translate the entire conversation x

How to Average an Infotable Value

A_10333884
10-Marble

How to Average an Infotable Value

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).

ACCEPTED SOLUTION

Accepted Solutions

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

 

 

 

View solution in original post

3 REPLIES 3

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

 

 

 

CharlesJi
15-Moonstone
(To:Rocko)

Hi @AF_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

dgg
13-Aquamarine
13-Aquamarine
(To:A_10333884)

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

dgg

 

Announcements


Top Tags