Loading TOC...

MarkLogic 10 Product Documentation
op.call

op.call(
   moduleUri as String,
   functionName as String,
   [args as String]
) as expression

Summary

This function to calls a built-in function on every row.

The call() function is needed only for built-in functions that aren't already supported by the Optic expression functions that appear in the Value Processing Functions list.

Use the call() function with care and only for functions that transform values without side effects. Some builtins could adversely affect performance, create deadlocks through the need for update transactions, or worse. The following restrictions apply to the op.call() function:

Parameters
moduleUri The URI of the function module.
functionName The function name.
args The function arguments.

Example

// Returns the host name and MarkLogic version.

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

op.fromLiterals([{row:1}])
  .select([
      op.as('hostName', op.call('http://marklogic.com/xdmp', 'host-name')),
      op.as('version',  op.call('http://marklogic.com/xdmp', 'version'))
      ])
  .result();

  

Example

// Concatenates 'EmployeeID' with '_x'.

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

const employees = op.fromView('main', 'employees');

 employees.select(['EmployeeID',
      op.as('concatenated',
             op.call('http://www.w3.org/2005/xpath-functions', 'concat',
                     [op.col("EmployeeID"), "_x"]))
                  ])
	        .result();

  

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