cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Migrate apoc.asFunction to apoc.custom.declareFunction

Hello,

I want to migrate to the new declareFunction as asFunction is deprecated, but I have a hard time defining a custom function with multiple parameters.

The documentation and testcases only contains a single parameter with the name input.
Every other parameter name seem to fail and extra parameters seem to be ignored.

I tried this query:

CALL apoc.custom.declareFunction('foobar(input::NODE, y::NODE) ::(NODE)',
'MATCH (n) RETURN n limit 1');

The declaration looks successful but when looking at the defined function (call apoc.custom.list) it looks like this:

"function"	"foobar"	""	null	"MATCH (n) RETURN n limit 1"	[["input", "node"]]	"node"	false

Any ideas how to solve this?

Cheers,
Ron

1 ACCEPTED SOLUTION

Hi @rweverwijk
There seems to be a bug with single character parameters ( y in your case)
In fact, with CALL apoc.custom.declareFunction('foobaz((input::NODE, input2::NODE)) ::(NODE)', 'MATCH (n) RETURN n limit 1');'); the input field is [["input", "node"], ["input2", "node"]].

I created an issue for this one: The procedure apoc.custom.declareFunction does not work correctly with single character parameters ·...

View solution in original post

2 REPLIES 2

Hi @rweverwijk
There seems to be a bug with single character parameters ( y in your case)
In fact, with CALL apoc.custom.declareFunction('foobaz((input::NODE, input2::NODE)) ::(NODE)', 'MATCH (n) RETURN n limit 1');'); the input field is [["input", "node"], ["input2", "node"]].

I created an issue for this one: The procedure apoc.custom.declareFunction does not work correctly with single character parameters ·...

Perfect, thanks a lot, I was blindsided by the single character issue!