Skip to main content
1-Visitor
September 26, 2019
Question

Sum values of one column in grid widget.

  • September 26, 2019
  • 1 reply
  • 1433 views

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

raluca_edu
17-Peridot
January 20, 2020

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