Solved

Order of OR statement affecting results

Posted on 2012-04-12
2
248 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

707 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