<cfscript>
if (Len(qDates.ID1) AND Len(qDates.ID2) AND Len(qDates.ID4)) // if 1, 2, and 4 contain a value (other than blank)
variable.status = 1;
else if (Len(qDates.ID1) AND Len(qDates.ID2) AND NOT Len(qDates.ID4)) // if 1 and 2 contain a value and 4 does not
variable.status = 2;
else if (Len(qDates.ID1) AND NOT Len(qDates.ID2) AND NOT Len(qDates.ID4)) // if 1 contains a value and 2 and 4 do not
variable.status = 3;
else if (NOT Len(qDates.ID1) AND Len(qDates.ID3); // if 1 does not contain a value and 3 does
variable.status = 4;
else if (Len(qDates.ID1) AND NOT Len(qDates.ID3)) // if 1 contains a value and 3 does not
variable.status = 5;
</cfscript>
You would be passing this bit of code a value in 1, 2 and 4 in order for variable.status to be set to 1 every time. Have you tried isolating the code bit and testing it seperately to see if you get the results out of that logic you expect?
- Calvin
----- Original Message -----
From: Cutter (CF-Talk)
To: CF-Talk
Sent: Sunday, September 28, 2003 12:20 AM
Subject: What's wrong with this...
Why does this always evaluate to 1?
<cfif (qDates.ID1 is not "") AND (qDates.ID2 is not "") AND (qDates.ID4
is not "")>
<cfset variable.status = 1>
<cfelseif (qDates.ID1 is not "") AND (qDates.ID2 is not "") AND
(qDates.ID4 is "")>
<cfset variable.status = 2>
<cfelseif (qDates.ID1 is not "") AND (qDates.ID2 is "") AND (qDates.ID4
is "")>
<cfset variable.status = 3>
<cfelseif (qDates.ID1 is "") AND (qDates.ID3 is not "")>
<cfset variable.status = 4>
<cfelseif (qDates.ID1 is not "") AND (qDates.ID3 is "")>
<cfset variable.status = 5>
</cfif>
This is driving me nuts. I can never seem to get the IF...AND to work
right. What am I missing here?
Cutter
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

