I need to implement something of a ternary operator that can help me return some default values from cypher query itself.
Scenario is -
if an employee's city is Delhi, return 5 else return 10
Something like a ternary operator.
start employee = node(5) return employee.city == 'DELHI' ? 5 : 10 as val;I tried things like
start employee = node(5) return coalesce (employee.city == 'DELHI', 5)but no luck.
Is there a way to implement such a scenario in neo4j be it Cypher or Traversal.
I have posted the same question on stackoverflow - http://stackoverflow.com/questions/11629913/ternary-operator-default-value-in-neo4j-cypher
It needs to. Will it make cypher less pure? Absolutely, but we have to be pragmatic here.