I get the following error for my cypher query (quoted below):
Invalid input 'p': expected
'n/N' or 's/S'
(line 1, column 116 (offset: 115))
"OPTIONAL MATCH (m:MeasurementSite)-[*2]-(v:Val)
WHERE ID(m) = $meter
AND v.d < $end
AND v.d > $start
WITH v, CALL
apoc.do.when(v IS NOT NULL,
'RETURN abs(toInteger(apoc.temporal.format(duration.inDays($date, $d), \'dd\')))',
'RETURN null',
{d: v.d, date: $date}) AS dist
RETURN v, dist;"
The referenced p
is the second character in apoc
.
Link for CALL
is here. Does anybody know the problem and is it related to (wrong) quotes?
Seems like you can start a query with CALL apoc.do.when()
, but you cannot use it in somewhere in the middle of a query.
Working on version 4.
The CALL clause cannot be used inside other clauses.
In addition, your WHERE
clause effectively filters out v
values that are NULL
, so:
v
is NULL
, andMATCH
doesn't need to be OPTIONAL
either.Therefore, this should be good enough:
MATCH (m:MeasurementSite)-[*2]-(v:Val)
WHERE ID(m) = $meter
AND v.d < $end
AND v.d > $start
RETURN v, {d: v.d, date: $date} AS dist;