Loading TOC...

op.call

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

Summary

This function calls value processing built-in functions that aren't listed in the list Value Processing Functions, the API also provides a general-purpose constructor for deferred calls.

Use this function with care because some builtins could adversely affect performance or worse. The following restrictions apply to the use of 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.