max( )


Refines a WixDataAggregate to only contain the maximum value from each aggregation group.

The max() function refines a WixDataAggregate to contain the maximum value 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: "propertyNameMax", where propertyName is the name of the specified property.
  • The value is the maximum value found in the specified property.

The following types of properties can be compared to determine a maximum value:

  • Number: Compares numerically.
  • Date and Time: Compares JavaScript Date objects.
  • Text: Compares lexicographically, so "text" is greater than "Text".
  • Rich Text: Compares HTML source as text.
  • URL: Compares as text.
  • Image: Compares image source as text.
  • Video: Compares video source as text.
  • Document: Compares document source as text.
  • Reference: Compares by the ID of the referenced item as a String.

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 maximum value.


projectedNamestring

The name of the property in the aggregation results containing the maximum value.

Returns
Return Type:WixDataAggregate
Was this helpful?
Yes
No