apoc.custom.asFunction

Procedure APOC Full Deprecated

apoc.custom.asFunction(name, statement, outputs, inputs, forceSingle, description) - register a custom cypher function

Signature

apoc.custom.asFunction(name :: STRING?, statement :: STRING?, outputs =  :: STRING?, inputs = null :: LIST? OF LIST? OF STRING?, forceSingle = false :: BOOLEAN?, description =  :: STRING?) :: VOID

Input parameters

Name Type Default

name

STRING?

null

statement

STRING?

null

outputs

STRING?

inputs

LIST? OF LIST? OF STRING?

null

forceSingle

BOOLEAN?

false

description

STRING?

Usage Examples

We can create the function custom.double, that doubles the provided value, by running the following function:

CALL apoc.custom.asFunction(
  'double',
  'RETURN $input*2 as answer',
  'long',
  [['input','number']]
);

We can use this function, as shown in the query below:

RETURN custom.double(12) AS value;
Table 1. Results
value

24