Loading TOC...

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.
numericExpression The divisor numeric expression.

Example


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

employees.select(["FirstName", "LastName", "Position", "EmployeeID",
                   op.as("divided", op.divide(op.col("EmployeeID"), 2)),
                   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.