0
votes

I am trying to send a list of strings to Neo4j using Neo4jClient to be used in a FOREACH cypher loop. The problem I am facing is that instead to creating different nodes for each string , the program creates just one node with the property Name set as the complete comma separated list.

The Code I am Using :

GraphClient graphClient = new GraphClient(new Uri("http://neo4j:a@localhost:7474/db/data"));
        graphClient.Connect();
        graphClient.Cypher
          .With("[{listTags}] AS T1")
          .ForEach("( n in T1| Merge (p: NPT {Name: n})")
          .OnCreate().Set("p.Mod =0")
          .OnMatch().Set("p.Mod = 0)")
           .WithParams(new { listTags = ResultString })
          .ExecuteWithoutResults();
1

1 Answers

0
votes

I have found the solution. Instead of using .With("[{listTags}] AS T1") I changed it to .With("{listTags} AS T1"). ( Dropped the Square Brackets). It Works Now. Thanks anyways.