Raghav Singh
Raghav Singh

Reputation: 143

Getting error while runing multiple return statement from cypher query

I'm using neo4j graph db and Is this syntax error or wrong procedure I'm getting some error like this: array(4) { ["message"]=> string(108093) "Don't know how to treat that as a predicate: my query is

       "query" => "match (u : UserProfile {token:{Token}})-[:HAS_SUBSCRIBED]->(upd)-   [:POSTED_UPDATE|PREV*0..]->(sel)
                    return (upd.image OR upd.logo),upd.firstName,upd.uId,sel.content,sel.created skip 0 limit 15",
    "params" => array (
            "Token" => "$token" 
    ) 

I want to return image or logo what ever key users have because same node I'm using for company that has logo and user has image.

Upvotes: 0

Views: 192

Answers (1)

Stefan Armbruster
Stefan Armbruster

Reputation: 39925

The OR operator applies to boolean expressions. I guess you want to use the COALESCE function which returns the first non-null argument in it's parameter list:

...
return coalesce(upd.image, upd.logo), ...

Upvotes: 1

Related Questions