Solved

Order of OR statement affecting results

Posted on 2012-04-12
2
246 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
ID: 37838291
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
ID: 37839522
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

12 Experts available now in Live!

Get 1:1 Help Now