Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Boolean AND doesn't work Post Reply Post New Topic
Author Message
TokyoAnt
Newbie
Newbie


Joined: 16 Feb 2007
Online Status: Offline
Posts: 30
Quote TokyoAnt Replybullet Topic: Boolean AND doesn't work
    Posted: 09 Apr 2007 at 6:50pm
Hi, this conditional is acting 'illogically'.
 
EmploymentEnd date is null for a field I am monitoring for test purposes. This would deny the AND condtion & return false, hence, the entire conditional would return false as it needs both conditions to be true. Right?
 
Yet the color still turns white (255,255,255)
 
How can this be if the EmploymentEndDate is null?
 
Interestingly, the color doesn't turn white for resources that do have a date!!
 
The logic below dictates that EmplymentEndDate MUST NOT be NULL for the conditional to return true. i.e. White
 
Also, currently, there are no StartDates that are greater than EmplymentStartDate. Not that this should matter as the consition is settled on the right side of the AND.
 
What is going on??
 
Thanks very much for any ideas on this. Here is the code:
 
 
if (

 ({ResourceUsageReportHeader.StartDate1} > {Resource.EmploymentEndDate})
 and
(Not Isnull({Resource.EmploymentEndDate}) )
)

then

color(255,255,255)

IP IP Logged
TokyoAnt
Newbie
Newbie


Joined: 16 Feb 2007
Online Status: Offline
Posts: 30
Quote TokyoAnt Replybullet Posted: 09 Apr 2007 at 7:28pm
I'v'e tested it this way:
 
if (  true
 
 and
(Not Isnull({Resource.EmploymentEndDate}) ) //must have value
)

then

color(255,255,255)    // turns white for only fields whose EmploymentEndDate is not null i.e. it works ok

if (  false      //can never return true
 
 and
(Not Isnull({Resource.EmploymentEndDate}) )
)

then

color(255,255,255)  // all fields remain same colour i.e. as one condition is faluse. works ok

but then why does this turn all nulls to white and other values thier set colours?
 
if (

 ({ResourceUsageReportHeader.StartDate1} > {Resource.EmploymentEndDate})
 and
(Not Isnull({Resource.EmploymentEndDate}) )  //must have value
)

then

color(255,255,255) doesn't work

Thanks for any ideas on this
 
Ant
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 10 Apr 2007 at 10:52am

You have to do your check for not IsNull() PRIOR to the checking the other condition, otherwise the null value is just skipped.  Try your original formula this way:

if ( 
 (Not Isnull({Resource.EmploymentEndDate}) )
 and ({ResourceUsageReportHeader.StartDate1} > {Resource.EmploymentEndDate})
)
then
color(255,255,255)
 
-Dell
IP IP Logged
TokyoAnt
Newbie
Newbie


Joined: 16 Feb 2007
Online Status: Offline
Posts: 30
Quote TokyoAnt Replybullet Posted: 10 Apr 2007 at 2:21pm

Hi Hilfy,

 

Thanks very much!

 

So of coarse, the AND is a conditional AND, it skips the second check if the first is false!

Thank you very much for your help!
 
Ant
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.