Solved

Order of OR statement affecting results

Posted on 2012-04-12
2
247 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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 …
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

730 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