Loading TOC...


   $leftCol as String,
   $rightCol as String
) as ondef


Specifies an equijoin using one columndef each from the left and right rows. The result is used by the prototype.joinInner and prototype.joinLeftOuter functions.

Use op.viewCol or op.col if you need to identify columns in the two views that have the same column name.

$leftCol The rows from the left view.
$rightCol The row set from the right view.


// Calculate the total expenses for each employee and return results in order of employee number.

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

const employees = op.fromView('main', 'employees');
const expenses = op.fromView('main', 'expenses');
const totalexpenses  = op.col('totalexpenses');
const Plan =
employees.joinInner(expenses, op.on(employees.col('EmployeeID'), expenses.col('EmployeeID')))   
   .groupBy(employees.col('EmployeeID'), ['FirstName', 'LastName', expenses.col('Category'),
    op.sum(totalexpenses, expenses.col('Amount'))])


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


The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.