Multiple "and" conditions in a Crystal Reports If-Then-Else formula

I have an If-Then-Else formula which evaluates 3 conditions.  Crystal Reports is only reading the first 2 and returning the result.  I've included the code logic below:
if {field1} = 'String'
and {field2} = 'String'
and {filed3] = 'String'
then count({field4})
else 0

Open in new window

pjgerwitzAsked:
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.

mlmccCommented:
How do you know it is only reading the first 2?

Can any of the fields be NULL?
Crystal will stop execution if a field is NULL
ALso if Crystal can determine that it is false then it will stop execution.  So if Field2 is "Jones' the condition is false.

mlmcc
0
pjgerwitzAuthor Commented:
I've also got 3 parameter fields used in record selection formluas.

As I played with the formula in question  more, it is not evaluating any of the criteria and simply returning the record count based on the parameter fields.

The data source is an Oracle view which does not return any null values, so that shouldn't be an issue.
0
mlmccCommented:
Where is the formula?

mlmcc
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

pjgerwitzAuthor Commented:
I placed the formula in the report footer, rather than the details section.
0
jgbreedenCommented:
If you want to count the records that match that criteria, you need a little different approach.  I suspect is it giving you the results of the last record you process--i.e., if the very last record evaluates to true, it gives you the count for the whole recordset.

Create a running total, type is count, and put the criteria in "Evaluate--Use a formula".  Or change the current formula to "then 1 else 0", then create a summary field that sums up this one.
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:
What are you trying to do with the formula?

mlmcc
0
pjgerwitzAuthor Commented:
Thanks.  That worked perfectly.
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.