I'm having trouble getting this query to work:
MATCH (pb:PRO{code: $pb, letter:$L})-[customerof:CUSTOMER_OF]->(c:CUSTOMER)-[:HAS_CONTRACT]->(con:CONTRACT)-[:HAS_POSITION]->(pos:POSITION)-[:HAS_PRODUCTS]->(prod:PRODUCT) WHERE
(
'ALL' in $filter
or
(
'FIRST' in $filter
and (prod.famprod in ['AC','DT'] and not prod.contractType in ['95|FUNDS']))
or
(
'SECOND' in $filter
and not prod.famprod in ['AC'] OR(prod.famprod IN ['AC','DT'] and prod.contractType in ['95|FUNDS'])
)
)
and
(
$customerType='ALL'
or
(
$customerType='SINGLE'
and
customerof.flagSingle='1'
)
or
(
$customerType='NOTSINGLE'
and
customerof.flagSingle='0'
)
)
The problem arises when I run 'FIRST' OR 'SECOND': running 'FIRST' the query, despite the "not" returns also prod.contractType in ['95|FUNDS']; running 'SECOND' the return is right.
I'm not so good with neo4j (first experience) and i can't solve the problem: i tried almost 20 different combinations but it doesn't work.
It looks like they are mirrored: when i try to modify 'FIRST', sometimes it changes the return of 'SECOND'.
'ALL' works fine.
Can you help me to get the right return?
Thanks