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".
Joined: 22 May 2009
Online Status: Offline
Posts: 347
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.
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.
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") )
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