BeautifulBee
BeautifulBee

Reputation: 3

Neo4j is returning No Value for cypher query

I have a duration column in a csv file with the following format: "0:00:00". I created these nodes in Neo4j:

LOAD CSV WITH HEADERS FROM "file:///file.csv" AS line
CREATE (testnode: Event {
  tph: toInteger(substring(line.Dur,0,1)),
  tpm: toInteger(substring(line.Dur,2,2)),
  tps: toInteger(substring(line.Dur,5,2))
})

Then I typed the following query to create a duration:

MATCH (n:Event)
UNWIND duration({hours: n.tph, minutes: n.tpm, seconds: n.tps}) AS duration
RETURN duration.minutes

Neo4j answer was: hours must be a number value, but was a NoValue. Maybe this is a wrong way to create durations using a map, I need to know how to do it.

Upvotes: 0

Views: 107

Answers (1)

Brakebein
Brakebein

Reputation: 2237

I don't think you can unwind a duration. Only lists can be unwinded. You probably want to use WITH instead of UNWIND.

MATCH (n:Event)
WITH duration({hours: n.tph, minutes: n.tpm, seconds: n.tps}) AS duration
RETURN duration.minutes

Upvotes: 1

Related Questions