Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Various "Or" Statements Post Reply Post New Topic
Author Message
Ibzy
Newbie
Newbie
Avatar

Joined: 16 Sep 2009
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote Ibzy Replybullet Topic: Various "Or" Statements
     Posted: 16 Sep 2009 at 3:57am
Hi folks!
I'm a self taught Crystal user and have managed to get my head around most things, however this one is starting to annoy me.

I need to pull through accounts if they have a specific date in any of 6 fields. Thus my Record Selection formula looks like so:

({CLIENT_EXTRA_TH.SPARE_CHAR_05} = "15/09/2009" or
{CLIENT_EXTRA_TH.SPARE_CHAR_06} = "15/09/2009" or
{CLIENT_EXTRA_TH.SPARE_CHAR_07} = "15/09/2009" or
{CLIENT_EXTRA_TH.SPARE_CHAR_08} = "15/09/2009" or
{CLIENT_EXTRA_TH.SPARE_CHAR_09} = "15/09/2009")

For some reason, the report only pulls through where SPARE_CHAR_05 = "15/09/2009". If I change the order so that (for example) SPARE_CHAR_07 is at the top, it pulls through the accounts where SPARE_CHAR_07 = "15/09/2009".

Any help on this would be greatly appreciated.

Thanks

Edited by Ibzy - 16 Sep 2009 at 4:39am
IP IP Logged
FrnhtGLI
Senior Member
Senior Member
Avatar

Joined: 22 May 2009
Online Status: Offline
Posts: 347
Quote FrnhtGLI Replybullet Posted: 16 Sep 2009 at 5:00am
This is not going to be the most expert opinion, but I've noticed that sometimes Crystal reacts differently by adding some parenthasis. Try something like:
 
({CLIENT_EXTRA_TH.SPARE_CHAR_05} = "15/09/2009") or
({CLIENT_EXTRA_TH.SPARE_CHAR_06} = "15/09/2009") or
({CLIENT_EXTRA_TH.SPARE_CHAR_07} = "15/09/2009") or
({CLIENT_EXTRA_TH.SPARE_CHAR_08} = "15/09/2009") or
({CLIENT_EXTRA_TH.SPARE_CHAR_09} = "15/09/2009")
 
I know it seems mundane, but I've noticed that it works sometimes. Hope it helps.
IP IP Logged
Ibzy
Newbie
Newbie
Avatar

Joined: 16 Sep 2009
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote Ibzy Replybullet Posted: 16 Sep 2009 at 5:08am
Thanks for your reply.
Unfortunately I have already tried several arrangements of parenthesi, including your suggestion.
I'm assuming the 'or' isn't being picked up as an 'or' for whatever reason.

Any other ideas?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Sep 2009 at 7:02am
Are you doing any Outer joins in this report?
If youa re doing any joins do they impact this seelct statement?
Is this the only criteria in your select statement?
These are all string fields all on one row of data correct?
If you make this into a formula field and place it on the details row in your report does it apply True/ False correctly to each row?
 
 
IP IP Logged
Ibzy
Newbie
Newbie
Avatar

Joined: 16 Sep 2009
Location: United Kingdom
Online Status: Offline
Posts: 6
Quote Ibzy Replybullet Posted: 16 Sep 2009 at 7:15am
These were the only criteria in my selection.
I have managed to find a solution, which I'll post for anybody elses reference, should they have this problem:

The fields in some instances were null, thus as soon as the record selection found those where it did equal 15/09/2009, it disregarded anythign that was null.
From adding an 'isnull' function i was able to navigate around the problem as such:


((not(isnull({CLIENT_EXTRA_TH.SPARE_CHAR_05}))and {CLIENT_EXTRA_TH.SPARE_CHAR_05})) = "15/09/2009") or
(not(isnull({CLIENT_EXTRA_TH.SPARE_CHAR_06}))and {CLIENT_EXTRA_TH.SPARE_CHAR_06})) = "15/09/2009") or
(not(isnull({CLIENT_EXTRA_TH.SPARE_CHAR_07}))and {CLIENT_EXTRA_TH.SPARE_CHAR_07})) = "15/09/2009") or
(not(isnull({CLIENT_EXTRA_TH.SPARE_CHAR_08}))and {CLIENT_EXTRA_TH.SPARE_CHAR_08})) = "15/09/2009") or
(not(isnull({CLIENT_EXTRA_TH.SPARE_CHAR_09}))and {CLIENT_EXTRA_TH.SPARE_CHAR_09})) = "15/09/2009") )


Hope this helps others :)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 16 Sep 2009 at 7:21am
Another weird NULL issue.
Thanks for posting the solution.
I wondered about that but seemed unlikely in this case. I generally found this as an issue in IF-THEN formulas and not OR formulas.
A warning that I found I always have to handle the NULL part first in If-Then statements.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum