Get nodes and relationships with hops excluding relationship types

Hi,

I need to get nodes and relationships with 1 to 3 hops excluding relationship types.
All relationships have the attribute "relType" ('10','20','30',...)
I want to exclude '20', so it won't return the relationships and also not the nodes that has ONLY relType='20'
i started with:
MATCH (c {nodeId: '123'})-[r*1..3]-(p)
So far it returns all.
Now, where to put the "WHERE" cluase?
" WHERE r.relType <> '20' " doesn't work because r is an array of rels...

Also consider this:
"c" and "p" can be any kind of nodes (Person, Company, Factory...)

Thanks,

If you just want to expand your example, you can write the WHERE clause here by using an all expression which needs to hold for all members of a list:

MATCH (c {nodeId: '123'})-[r*1..3]-(p)
WHERE all(relationship IN r WHERE relationship.relType <> '20')

However, you can also express this more concisely using a quantified relationship, which was introduced in 5.9:

MATCH (c {nodeId: '123'})-[r WHERE r.relType <> '20']-{1,3}(p)