Loading TOC...

op.add

op.add(
   numericExpression as String,
   numericExpression as String
) as numericExpression

Summary

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.

Parameters
numericExpression The left numeric expression.
numericExpression The right numeric expression.

Example

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

const employees = op.fromView('main', 'employees');

employees.offsetLimit(op.param('start'), op.param('length'))
	   .select(['EmployeeID', 
                op.as('incremented', 
                       op.add(op.col('EmployeeID'), op.param('increment')))
               ])
	   .result(null, {start:1, length:2, increment:1});

  

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