op:group( [$columns as columnIdentifier*] ) as map:map
This function specifies the grouping keys for a group as a list of zero or more columns. The result is used for building the first parameter for the op:group-by-union function.
Parameters | |
---|---|
$columns | The columns (if any) to use as grouping keys. The columns can be named with a string or a column parameter function such as op:col or constructed from an expression with op:as. |
xquery version "1.0-ml"; import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy"; op:from-view("main", "expenses") => op:group-by-union( (op:group(), op:group(("Category", "Location"))), op:sum("TotalAmount", "Amount") ) => op:order-by(("Category", "Location")) => op:result()