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.

How to mantain an order when creating nodes

Neo4j community server 4.3.4 Ubuntu 20.04

I have a question that I wasn't able to solve:

while importing from a CSV file, with ";" as separator, I have a field which contains some element separed by comma.

I need to UNWIND those elements and create a relationship between two nodes maintaining the source ordering, as in the followin fragment:

    MATCH (x:X {uuid: "xyz"}

	UNWIND allowedTypes as allowedType
		MATCH (p:P {name: trim(allowedType)})

		MERGE (x)-[isAllowedWith:IS_ALLOWED_WITH]->(p)
               SET isAllowedWith.order = <Ordinal position in the allowedTypes array>

I tried

			SET isAllowedWith.order = datetime.realtime()

It run, but I don't really like the approach.

I give a look at the documentation, but have no idea how to solve the problem.

Any suggestion will be appreciated.

0 REPLIES 0