op:add( $left as item(), $right as item() ) as map:map
This function returns the sum of the specified numeric expressions. In expressions, the call should pass the result from an op:col function to identify a column.
The op:add function differs from the op:sum function in that it operates on operates on multiple column values in a row, rather than a group of rows.
As a convenience, you can pass a sequence of any number of expressions as the
first argument: op:add((expr1, expr2, ..., exprN))
Parameters | |
---|---|
$left | The left value expression. |
$right | The right value expression. |
xquery version "1.0-ml"; import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy"; let $employees := op:from-view("main", "employees") return $employees => op:offset-limit(op:param('start'), op:param('length')) => op:select(('EmployeeID', op:as('incremented', op:add(op:col('EmployeeID'), op:param('increment'))) )) => op:result((), map:entry("start",1)=>map:with("length",2)=>map:with("increment",1))