ModifyPlan.prototype.where( booleanExpression as xs.boolean ) as ModifyPlan
This method restricts the row set to rows matched by the boolean expression. Use boolean composers such as op.and and op.or to combine multiple expressions.
A constraining document query returns only the rows from the matched source documents. If the constraining document query is a node instead of a cts.query object, the implementation calls the cts.query parser on the node. The constraining document query applies to all upstream accessors. A constraining sem.store returns only the triples from the specified store (potentially expanded by inference using a ruleset). A constraining sem.store applies to all upstream triples accessors.
Parameters | |
---|---|
booleanExpression | This can be a boolean expression, a cts.query to qualify the source documents that produced the rows set, or (where part of the row set was produced by the op.fromTriples accessor) a sem.store to restrict or expand the triples that produce the row set. |
where
is a method of the following classes:
// Locate employee expenses that exceed the allowed limit const op = require('/MarkLogic/optic'); const employees = op.fromView('main', 'employees'); const expenses = op.fromView('main', 'expenses'); const expenselimit = op.fromView('main', 'expenselimit'); const Plan = employees.joinInner(expenses, op.on(employees.col('EmployeeID'), expenses.col('EmployeeID'))) .joinInner(expenselimit, op.on(expenses.col('Category'), expenselimit.col('Category'))) .where(op.gt(expenses.col('Amount'), expenselimit.col('Limit') )) .select([employees.col('EmployeeID'), 'FirstName', 'LastName', expenses.col('Category'), expenses.col('Amount'), expenselimit.col('Limit') ]) .orderBy(employees.col('EmployeeID')) Plan.result();
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.