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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

How to retrieve data from aggregate function which from services in datatable.

xiaoqw
15-Moonstone

How to retrieve data from aggregate function which from services in datatable.

May I know how to put value which is from aggregate function in data table services, and what is the output? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaiChung
22-Sapphire I
(To:xiaoqw)

// 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

View solution in original post

5 REPLIES 5
PaiChung
22-Sapphire I
(To:xiaoqw)

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.

 

xiaoqw
15-Moonstone
(To:PaiChung)

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?

PaiChung
22-Sapphire I
(To:xiaoqw)

// 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

xiaoqw
15-Moonstone
(To:PaiChung)

If I want to retrieve single column data and do calculation with variables. how to retrieve the single data?

PaiChung
22-Sapphire I
(To:xiaoqw)

You'll have to maybe explain yourself a little better.

But with an infotable, you can work with any column in the table.

Top Tags