how to convert string values of an array to integer in neo4j?

590 views Asked by At

I am not being able to convert the string value of an array (e.g. score:["1", "0"]) into an Integer in Neo4j.

I have tried:

MATCH (n:Game {game_id:"1"})
RETURN toInteger(n.score[0])

This query returns a null value as a result.

1

There are 1 answers

0
Gabor Szarnyas On BEST ANSWER

I tried your query, but it works fine for me. This is my example data set:

CREATE (n:Game {game_id:"1", score:["1","0"]})

This is the query:

MATCH (n:Game {game_id:"1"})
RETURN toInteger(n.score[0])

And it returns:

╒═══════════════════════╕
│"toInteger(n.score[0])"│
╞═══════════════════════╡
│1                      │
└───────────────────────┘