Loading TOC...

MarkLogic 12 Product Documentation
op.modulo

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

Summary

This function returns the remainder afer the division of the dividend and divisor expressions. For example, op:modulo(5, 2) returns 1.

Parameters
numericExpression The dividend numeric expression. It can be a number, a column function such as op.col, op.viewCol, or op.schemaCol, or expressions.
numericExpression The divisor numeric expression. It can be a number, a column function such as op.col, op.viewCol, or op.schemaCol, or expressions.

Example

const op = require('/MarkLogic/optic');
const employees = op.fromView('main', 'employees');

employees.select(["FirstName", "LastName", "Position", "EmployeeID",
                   op.as("modulo", op.modulo(op.col("EmployeeID"), 2))])
.result();
  

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