Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
May I know how to put value which is from aggregate function in data table services, and what is the output?
Solved! Go to Solution.
// result: INFOTABLE dataShape: "RootEntityList"
var tempTable = ThingTemplates["GenericThing"].GetImplementingThings();
var params = {
t: tempTable /* INFOTABLE */,
columns: "name" /* STRING */,
aggregates: "COUNT" /* STRING */,
groupByColumns: undefined /* STRING */
};
// result: INFOTABLE
var result = Resources["InfoTableFunctions"].Aggregate(params);
be sure to set the service output to InfoTable
I'm not sure if I'm answering the right question, but it sounds like you want to know how to use the Aggregate function provided in the infotable services?
Aggregate needs an infotable
second you specify which columns you want to operate on for example "col1,col2,col1,col3" note no spaces!
third you specify what aggregate you want to do per those columns "SUM,AVERAGE,MAX,MIN"
(last one would be COUNT)
You can specify columns by which it will do groupings
The output then will be an infotable that will feature SUM_col1, AVERAGE_col2, MAX_col1, MIN_col3 and your grouping columns if specified.
Hope that is what your quest is asking.
Thank you for ur reply. I think the logistic is correct. Could u show me the specific code like an example to go through it?
// result: INFOTABLE dataShape: "RootEntityList"
var tempTable = ThingTemplates["GenericThing"].GetImplementingThings();
var params = {
t: tempTable /* INFOTABLE */,
columns: "name" /* STRING */,
aggregates: "COUNT" /* STRING */,
groupByColumns: undefined /* STRING */
};
// result: INFOTABLE
var result = Resources["InfoTableFunctions"].Aggregate(params);
be sure to set the service output to InfoTable
If I want to retrieve single column data and do calculation with variables. how to retrieve the single data?
You'll have to maybe explain yourself a little better.
But with an infotable, you can work with any column in the table.