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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Sum values of one column in grid widget.

Rajesh_R
9-Granite

Sum values of one column in grid widget.

Hi,

I want to have a total values of one column in the grid widget. That total values should display in the text box widget. If anybody knows mean let me know. It will be very useful.

 

1 REPLY 1

Hi,

 

I don't know if you found a solution to you question, but I will tell you how I would do.

I would create a service where I get all the values I want to sum up (eg. use same service that is getting values in the Grid). I assume the values are in an infotable, I would use snippet for Aggregate to sum its elements:

  • In the service editor, on the Snippets tab, find and add the Aggregate snippet and modify it to the following:
var params = {
	t: myInfoTable/* INFOTABLE */,
	columns: "myColumn" /* STRING */,
	aggregates: "SUM" /* STRING */
};
var result = Resources["InfoTableFunctions"].Aggregate(params);
  • Access your desired SUM of a column by using the following syntax of  "SUM_" pre-pended before the infotable column name, example:
result.SUM_myColumn;

  The result should be bind with the text box widget value.

 

Hope it helps,

Raluca Edu

Announcements


Top Tags