Hi Koen,
Here is the link for the document:
https://neo4j-contrib.github.io/neo4j-apoc-procedures/#_overview_of_apoc_procedures_functions
Half way through you can see "Case Procedures" and you can see an example,
I understood from the example. Unfortunately, there is no full explanation
of the
Hi kamal this works fine and i included it into my overall query thanks.
So my final question on this would be
1) how to know that you have to put " " around the query part of the
query following the condition ?
2) how do you know that the syntax of "param" is like{w:w} ...
orby som
Hi Koen,
Here is a sample code with call apoc.do.case() procedure:
MERGE (w:Winery {testval:1})
WITH w
call apoc.do.case([w.testval=1, "SET w.a = 'bla1', w.b = 'bla2'",
w.testval=2, "SET node.a = 'bla3', node.b = 'bla4'"], "SET node.a = 'bla5',
node.b = 'bla6'", {w:w}) YIELD value
RETURN w;
Sy
Hi Kamal, thanks, i have seen this "construct" before and will test it.
However i am still very interested to learn how to use the call
apoc.do.case() procedure to implement this .. i expect that the result
might look somewhat more straightforward (to say the least) i.. and ideas
how to apply tha
Hi Koen,
Create a conditional statement by using FOREACH. If there’s a value for
your condition then it loops once and set the property and if not no
property will be set.
MERGE (server:Server { name: line.`Machine Name`, uuid: call
apoc.create.uuid() })
FOREACH(ignoreMe IN CASE WHEN testval=
Hi kamal. thanks, thats also how i do it now.
Maybe one other question to the community
Is there an example of a cypher query using a *call apoc.do.case()*
procedure where you want to have multiple "condition,query" pairs and where
each "query" performs multiple operations such as a property SET
Hi Koen,
If one GUUID for one machine name, then you can create unique constraint on
name property and this avoids duplicate records.
CREATE CONSTRAINT ON (s:Server) ASSERT s.name IS UNIQUE;
After creating this constraint, I ran MERGE (server:Server { name: "Test",
uuid: apoc.create.uuid() } s
H kamal thanks, that works too. i guess the original problem was due to the
"call" statement being there .. removing that seems to work although i
thought i tested that already .. it also needed small rewrite to SET the
uuid property to avoid duplicate record conflicts
so for apoc functions no cal
Hi Koen,
It is missing WITH line statement. Try this:
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS
FROM "file:///test.csv" AS line FIELDTERMINATOR ';'
*WITH line, * *apoc.create.uuid() as uid*
MERGE (server:Server { name: line.'Machine Name`, uuid: *uid* })
Or,
USING PERIODIC COMMIT
LOAD CSV WI