MarkLogic Server 11.0 Product Documentation
op.sequenceAggregate

op.sequenceAggregate(
   aggColName as String,
   columndef as String,
   [options as String]
) as aggregatedef

Summary

This call constructs a sequence whose items are the values of a column for each row in the group or row set. The result is used for building the parameters used by the prototype.groupBy function.

Parameters
aggColName The name to be used for the aggregated column.
columndef The column with the values to aggregate.
options The options can take a values key with a distinct value to average the distinct values of the column.

Example

const op = require('/MarkLogic/optic');

op.fromView('main', 'expenses')
   .groupBy('Category', op.sequenceAggregate("Sequence Array", "Amount"))
   .orderBy('Category')
   .result();
   
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy