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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Subquery and aggregate function with datatable

PG_9957352
5-Regular Member

Subquery and aggregate function with datatable

Hi,

 

I have a DataTable in Thingworx storing data from csv spreadsheet.

 

I need to perform advanced queries with aggregate functions grouped by multiple columns.

Conceptually, my case is similar to this:

https://stackoverflow.com/questions/24657624/aggregate-function-in-group-by-multiple-columns

 

In particular, the datashape of the DataTable is:

 

let newEntry = {
   Employee: undefined, // STRING [Primary Key]
   LaborTime: undefined, // NUMBER
   Project: undefined, // STRING [Primary Key]
   Month: undefined // STRING [Primary Key]
};

 

I need to compute the sum of LaborTime of all Employees for each Month, grouped by Project.

What is the code to perform such query?

The result should then be plotted in BarChart/LineChart widget.

 

Best,

Pietro

ACCEPTED SOLUTION

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

After you query the data from the datatable, there is an infotable function called 'Aggregate' which you can then use.

View solution in original post

1 REPLY 1
PaiChung
22-Sapphire I
(To:PG_9957352)

After you query the data from the datatable, there is an infotable function called 'Aggregate' which you can then use.

Announcements


Top Tags