Crystal Reports 2008 - using a Or statement

Hi and thanks

I want a formula that checks for 2 conditions on one field

Example:
{field1} = "1" Or "2"
{field1} = "1 Or 2"

I tried above but got errors


thanks
Amour22015Asked:
Who is Participating?
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.

Jared_SCommented:
try this:

{field1} = "1" Or {field1} = "2"
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
Amour22015Author Commented:
I tried:
{field1} = "1" Or {field1} = "2"

but received a lot of records so something is wrong with that formula

maybe:
({field1} = "1" Or {field1} = "2")

I am going to try that also...

Thanks
0
Amour22015Author Commented:
when I tried:
({field1} = "1" Or {field1} = "2")
Crystal reports converted it to:
{TEMP_PWC_Sales_Report_SP_MAIN.mclassextension_code} in ["100", "200"]

maybe it is now correct.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

mlmccCommented:
Was this part of a larger selection criteria?

mlmcc
0
Amour22015Author Commented:
mlmcc,

Yes some other criteria was involved.

{field1} and
{field2} and
{field3} and
{so on}

thanks
0
nicdeCommented:
in order to combine AND and OR operators you should separate them in groups with brackets: A=B AND (C=D OR D=E)

with the brackets the result will return all records with A=B and at least one of the other 2 C=D OR D=E
without the brackets  the result will be all records with A=B AND C=D + all records with D=E which is wrong

({field1} = "1" Or {field1} = "2") is the correct way to handle this.
Crystal will change your records selection formula to convert the Crystal Syntax to your database syntax if it is possible to apply the where clause on the server.
0
James0628Commented:
Not much to add.  It looks like you've got this pretty well covered.  But, FWIW, you could also use

{field1} in [ "1", "2" ]

 It's just another way to say the same thing.


 CR does not support the (A = B or C or D) type syntax.  You have to spell it out like (A = B or A = C or A = D), or use something else, like A in [ B, C, D ].

 James
0
Amour22015Author Commented:
Thanks
0
Amour22015Author Commented:
mlmcc,

Thanks you for bringing that to my attention.

How can I reopen the question? or is it you that can do that?

Thanks
0
Amour22015Author Commented:
when I tried:
({field1} = "1" Or {field1} = "2")
Crystal reports converted it to:
{TEMP_PWC_Sales_Report_SP_MAIN.mclassextension_code} in ["100", "200"]

Thank you for your help....
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.