sum( )


Refines a WixDataAggregate to contain the sum from each aggregation group.

The sum() function refines a WixDataAggregate to contain the sum of the values from the specified property for each aggregated group or from the whole collection if no group is defined.

When the aggregation is run, the returned WixDataAggregateResult object contains an item for each group with the following key:value pairs:

  • If a value was passed for the optional projectedName, the key is named using that value. Otherwise, the key is named using the following format: "propertyNameSum", where propertyName is the name of the specified property.
  • The value is the sum of the values found in the specified property.

Sums can only be calculated on properties of type Number.

Note: Aggregations can only be used on collections you have created. They cannot be used on Wix App Collections.

Method Declaration
Copy
Method Parameters
propertyNamestringRequired

The property in which to find the sum.


projectedNamestring

The name of the property in the aggregation results containing the sum.

Returns
Return Type:WixDataAggregate
Did this help?