Loading TOC...

op.groupConcat

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

Summary

This function concatenates the non-null values of the column for the rows 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 column with the concatenated values.
$columndef The name of the column with the values to be concatenated for the group.
$options The options can take a values key with a distinct value to average the distinct values of the column. In addition to the values key, the options can take a separator key specifying a separator character. The value can be a string or placeholder parameter.

Example


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

op.fromView('main', 'expenses')
   .groupBy('Category', op.groupConcat("Spent", "Amount"))
   .orderBy('Category')
   .result();

  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.