Solved

Order of OR statement affecting results

Posted on 2012-04-12
2
243 Views
Last Modified: 2012-06-21
I am using a running total field to evaluate three fields that represent different phone types: home, business or cell.  Some records have all three phone types, some have none, some have one, etc. I want to count those records that have at least one phone type.
My evaluate formula looks like this:

PhoneTypeHome = “Home”
OR
PhoneTypeBiz = “Business”
OR
PhoneTypeCell = “Cell”

There is one record that has only a Business phone type (Home and Cell are null).  When I run the report with the above formula it doesn’t count him for his Business phone.  But when I modify the formula and put the Business phone on top it does count it.

PhoneTypeBiz = “Business”
OR
PhoneTypeHome = “Home”
OR
PhoneTypeCell = “Cell”

I’ve never seen this before, where the order of my OR statements affect the results.  Any suggestions or ways to fix this?
0
Comment
Question by:Reader999
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
Comment Utility
As soon as a null value is found the code goes no further.
You have to test for nulls before testing for a value , if nulls can occur.

Can PhoneTypeHome  have any other non-null value apart from “Home”
(ditto for Biz and Cell?)
If the values you have shown are the only possible values then the simple way through this to test for all fields being null

If isnull({table.phonetypebiz} and isnull({table.PhoneTypeHome}) and isnull(table.PhoneTypeCell}) then
False
else
true

(I'm assuming you are creating a record selection formula)
0
 

Author Closing Comment

by:Reader999
Comment Utility
Thanks, that works!  Since I can't use an If-then-else in a running total formula, i just created a formula with your criteria and tied it into the running total field to summarize.  Then in the actual running total formula I specify for only records where the tied in formula = True.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now