Loading TOC...

op:modulo

op:modulo(
   $left as item(),
   $right as item()
) as map:map

Summary

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

Parameters
$left The dividend numeric expression.
$right The divisor numeric expression.

Example

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:select(("FirstName", "LastName", "Position", "EmployeeID",
                  op:as("divided", op:divide(op:col("EmployeeID"), 2)),
                  op:as("modulo", op:modulo(op:col("EmployeeID"), 2))               
       ))
    => op:result(); 
  

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