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.

Conditionning the relationship creation ON Neo4j

Hello,

I have a question about intermediate nodes. I posted my question on StackOverFlow here is the link : https://stackoverflow.com/q/74716943/13171153

My Question :
I would like to create relationship if a new intermediate node is created. In this code below, I would love to execute the last two MERGE if only i have a new node (:Consultation).
How can I do that please ?

MATCH
(dp:DossierPatient{numDos:2}),
(dr:Docteur{matricule:1}),
(ord:Ordonnance{numOrd:1})

MERGE (cons:Consultation{numDos:dp.numDos, codeDocteur:dr.matricule, dateC:'24/11/2022'})
ON CREATE SET cons.diagnostic='Allergies, tension anormale...'

//Create new relationships if new Consultation node is created
MERGE (dp) <-[:concerne]- (cons) -[:effectuee_par]-> (dr)
MERGE (cons) -[:possede]-> (ord);

If possible, i would love to put those two MERGE in the same bloc as **ON CREATE SET**

0 REPLIES 0