I want to use the aggregation function

I am trying use AggregationType.Sum for in source code schema for my web service but its not summing the the totals as i wanted to do. It only sends the first records Amount rather than finding the all the records with that condition match and total them up. Can anyone direct me to documentation of implementing this? 

 

 var esq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "UsrExample");
             
var totalSum = esq.AddColumn("UsrTotal");

totalSum .SummaryType = AggregationType.Sum; // Set aggregation to sum
             
// Added filters: 
           
FinalAmount= sessionCollection[0].GetTypedColumnValue(totalSum.Name);

 

Like 0

Like

5 comments

Hello Tony,

Example of adding the aggregate column to the query column collection (column must have the SUM aggregation type for all table records):

var esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
    rootSchemaName: "Activity"
});
esq.addAggregationSchemaColumn("DurationInMinutes", Terrasoft.AggregationType.SUM, "ActivitiesDuration", Terrasoft.AggregationEvalType.ALL);

You can read more in the article from the Academy.

Also I've found one more example in the Community question.

Is there an equivalent of doing aggregation in a query using the Model class of the Creatio SDK for Freedom UI?

Harvey Adcock,

Aggregation is not implemented in sdk.Model yet, so no, there is no equivalent for this in sdk.Model.

Thanks Oleg, is this in the roadmap?

Harvey Adcock,

Yes, I created a correspondent problem for the R&D team to implement this.

Show all comments