query.Aggregate
JavaScript does not include an enumeration type. The SuiteScript 2.x documentation uses the term enumeration (or enum) to describe a plain JavaScript object with a flat, map-like structure. In this object, each key points to a read-only string value.
Enum Description |
Holds the string values for aggregate functions supported with the N/query Module. An aggregate function performs a calculation on the column or condition values and returns a single value. Each value in this enum (except This enum is used to pass the aggregate function argument to Component.createColumn(options), Component.createCondition(options), Query.createColumn(options), and Query.createCondition(options). |
Module |
|
Sibling Module Members |
|
Since |
2018.1 |
Values
Value |
Description |
---|---|
|
Calculates the average value. |
|
Calculates the average distinct value. |
|
Counts the number of results. |
|
Counts the number of distinct results. |
|
Determines the maximum value. If the values are dates, the most recent date is determined. |
|
Determines the maximum distinct value. If the values are dates, the most recent date is determined. |
|
Calculates the median value. |
|
Determines the minimum value. If the values are dates, the earliest date is determined. |
|
Determines the minimum distinct value. If the values are dates, the earliest date is determined. |
|
Adds all values. |
|
Adds all distinct values. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/query Module Script Samples.
// Add additional code
...
var myTransactionQuery = query.create({
type: query.Type.TRANSACTION
});
var myAggColumn = myTransactionQuery.createColumn({
fieldId: 'amount',
aggregate: query.Aggregate.AVERAGE
});
myTransactionQuery.columns = [myAggColumn];
...
// Add additional code