Solved

Order of OR statement affecting results

Posted on 2012-04-12
2
244 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 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