inclusive "and" part of query not working

I am trying to exclude certain records from the report using the select record expert in CR, but when ever I set up the query like this (see bold part of query),

{investor.holdings} and
(not ({receiver.r_ussname} startswith "NON-USS:") and not ({investor.iaccountid} in ["35048"])) and
{trade.mdate_i} > {?Start Date} and
{trade.settle_i} <= {?Start Date} and
(not ({trade.icobbill} in ["B", "P"]) or {trade.iaccountid} = ["10107","12462","15227","10119","19331","10301","32051","32013","32109"])

CR keeps changing the query structure to this:


{investor.holdings} and
not ({receiver.r_ussname} startswith "NON-USS:") and
not ({investor.iaccountid} in ["35048"])
and
{trade.mdate_i} > {?Start Date} and
{trade.settle_i} <= {?Start Date} and
(not ({trade.icobbill} in ["B", "P"]) or {trade.iaccountid} = ["10107","12462","15227","10119","19331","10301","32051","32013","32109"])

and what happens is that it processes the augments separately instead of inclusively.

I am trying to use (not ({receiver.r_ussname} startswith "NON-USS:") and not ({investor.iaccountid} in ["35048"])) as a way to tell CR not to return records where both the receiver.r_ussname begins with "NON-USS" and the accountid begins with "35048". In otherwords, dont return any records where it is both "NON-USS" and "35048".

Not sure why this is happening, but there are two different tables that I am trying to query against in that statement, maybe that is the issue? If so, how do I get around that?

**Inclusively...I hope I used the right terminology.
IO_DorkAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raghavendra HullurSoftware DeveloperCommented:
When you say "what happens is that it processes the augments separately instead of inclusively. ", does that mean the data is wrong? or not returning records at all?

Can you try using below modified one and update the results?

{investor.holdings} and
not ( ({receiver.r_ussname} startswith "NON-USS:") and  ({investor.iaccountid} in ["35048"])) and
{trade.mdate_i} > {?Start Date} and
{trade.settle_i} <= {?Start Date} and
(not ({trade.icobbill} in ["B", "P"]) or {trade.iaccountid} = ["10107","12462","15227","10119","19331","10301","32051","32013","32109"])
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mlmccCommented:
The reason it is happening is since all the Boolean operators are AND there is no need for the ( ) around the pair.

I believe the suggestion above is what you want.

You could also do it as

(NOT ({receiver.r_ussname} startswith "NON-USS:") OR
 not ({investor.iaccountid} in ["35048"]) )

mlmcc
0
Raghavendra HullurSoftware DeveloperCommented:
Closing this as the question has become inactive and the solution provided is confirmed as best as per other expert's confirmation.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.