Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I am trying to use aggregate function on a "result" infotable. The aggregate function is returning and info table "result1". The infotable result1 column names are
infoTable content: {AVERAGE_1667.0=null, AVERAGE_1667.0_COUNT=com.thingworx.types.primitives.NumberPrimitive@0, AVERAGE_1667.0_SUM=com.thingworx.types.primitives.NumberPrimitive@0}
Please find my code below. How do I read the read the aggregated value(i.e Average values: 1667 this keeps changing every time I run this service)
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(US_NRV_Env_Reporting_Average_Value)
var result1 = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params1);
var params = {
t: result /* INFOTABLE */,
columns: me.Data_Reading/* STRING */,
aggregates: "AVERAGE" /* STRING */,
groupByColumns: undefined /* STRING */
};
// result: INFOTABLE
result1 = Resources["InfoTableFunctions"].Aggregate(params);
further you need to iterate result1 infotable using infotable for loop to get the aggregate value
for loop is present in snippets tab of service(under infotable functions)