RE: IIF and DE

2001-08-30 Thread Aidan Whitehall

 This problem is kinda hard to explain, but does anyone have 
 any idea on how
 to fix this??? (without having to use CFIF/CFELSE - the whole 
 point is that
 I want to use IIF and DE)

This isn't what you want to hear, but, FWIW I've had exactly the same thing
and ended up using CFIF. Annoying, but I couldn't figure out how to code the
Iif so that it didn't throw the error when it hit the undefined variable,
even if you put the undefined variable in the last part (what's the right
term?) of the Iif function.



Aidan
-- 
Aidan Whitehall [EMAIL PROTECTED]
Macromedia ColdFusion Developer
Fairbanks Environmental +44 (0)1695 51775
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: IIF and DE

2001-08-30 Thread Dave Feltenberger

What you have to do is this:

(assuming you're using variables temp1 and temp2)

IIF(condition, DE(#evaluate('temp1')#), DE(#evaluate('temp2')#))

By using evaluate, it doesn't try to pass the undefined variable in as a
parameter to the function, but when it hits the DE(), it does an evaluate()
and displays the contents of the variable anyway.

-Original Message-
From: Aidan Whitehall [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 10:12 AM
To: CF-Talk
Subject: RE: IIF and DE


 This problem is kinda hard to explain, but does anyone have
 any idea on how
 to fix this??? (without having to use CFIF/CFELSE - the whole
 point is that
 I want to use IIF and DE)

This isn't what you want to hear, but, FWIW I've had exactly the same thing
and ended up using CFIF. Annoying, but I couldn't figure out how to code the
Iif so that it didn't throw the error when it hit the undefined variable,
even if you put the undefined variable in the last part (what's the right
term?) of the Iif function.



Aidan
--
Aidan Whitehall [EMAIL PROTECTED]
Macromedia ColdFusion Developer
Fairbanks Environmental +44 (0)1695 51775
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: IIF and DE

2001-08-30 Thread Tyson Vanek

Not exactly.  IIF() creates an IF/ELSE scenario which, technically speaking,
could be considered two statements even though only one of them actually has
a condition defined.

Fact of the matter is, this comes down to what's called short circuit
logic.  In most languages in any if/else pair, once a match with one of the
if clauses is established, the rest of the if/else statement is simply
ignored - commonly referred to as short circuiting.  You'll find that
ColdFusion works this way with CFIF, CFELSEIF and CFELSE.  However, in the
case of IIF(), ColdFusion doesn't short circuit which means that it tries to
validate the entire statement block, even though only part of it actually
needs to execute.

Consider the following two code examples.  The first one will run without
any errors, but the second one, while performing the same logic, will fail.
This is because the first scenario gets short circuited and the second one
does not.

---[ begin example 1 ]---
cfset strFoo = foo
cfif isDefined(strFoo) and len(trim(strFoo))
cfoutputstrFoo = #strFoo#/cfoutput
cfelse
cfoutputstrFoo2 = #strFoo2#/cfoutput
/cfif
---[ end example 1 ]---

---[ begin example 2 ]---
cfset strFoo = foo
cfoutput
#iif(isDefined(strFoo) and len(trim(strFoo)),de(strFoo),de(strFoo2))#
/cfoutput
---[ end example 2 ]---

Hope that makes sense and/or helps.  :)

-Tyson

-Original Message-
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 8:05 PM
To: CF-Talk
Subject: RE: IIF and DE


Hi,

Good idea, but I think you missed the problem.  There is not two different
expressions to evaluate to be TRUE or FALSE as in your example -- just the
isDefined function.  CF shouldn't be executing the ... blah blah blah ...,
but it does, and that is the problem.

-Brent

-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 5:57 PM
To: CF-Talk
Subject: RE: IIF and DE


This goes back to the way the old CFIF used to behave.  In the past (I
think up until CF ver 4.5), the same problem existed with CFIF.  Here's an
example.  Say that the parameter strFoo doesn't exist, consider the
following code:

cfif isDefined(strFoo) and len(trim(strFoo))
... blah blah blah ...
cfelse
... blah2 blah2 blah2 ...
/cfif

In the past, ColdFusion would choke on the CFIF statement when strFoo was
not defined, even though you'd expect it to immediately jump to the CFELSE
statement once the isDefined() returned false.  I believe this was fixed
with the release of ColdFusion 4.5 - I might be wrong on the version number.

My guess is that this behavior is still leftover in the iif() function.
I've noticed this in my own development as well that I never seem to be able
to use an isDefined() check in an iif() block.  Doing so always results in
the Error resolving parameter error.

A workaround would be to set a default for the variable using CFPARAM and
then changing your iif() logic.  Here's an example:

cfparam name=attributes.order default=
cfset orderString =
iif(len(trim(attributes.order)),de(amp;order=#attributes.order#),)
cflocation url=index.cfm?fuseaction=tools#orderString#

Hope this helps,
Tyson

-Original Message-
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 7:36 PM
To: CF-Talk
Subject: IIF and DE


Hi,

I'm trying to use IIF with DE, and it doesn't seem to be working.  My code:
cfset orderString = iif(isDefined(attributes.order),
DE(amp;order=#attributes.order#), )
cflocation url=index.cfm?fuseaction=tools#orderString#

What I am trying to do is this: if a certain variable is defined
(attributes.order), then create a string that can be appended to a URL,
otherwise make the string blank.
The desired results:
   - If attributes.order is set to name, then orderString should be set to
amp;order=name
   - If attributes.order is undefined, then orderString should be set to 

The problem is that when attributes.order is undefined, ColdFusion still
tries to execute the code that should be executed if the first expression
was true, thus giving an error.  CF is trying to find the value of
attributes.order in the DE(amp;order=#attributes.order#) statement, even
though attributes.order is undefined, and that statement should go with
being evaluated.

This problem is kinda hard to explain, but does anyone have any idea on how
to fix this??? (without having to use CFIF/CFELSE - the whole point is that
I want to use IIF and DE)

Thanks
-Brent
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: IIF and DE

2001-08-30 Thread Dave Feltenberger


ColdFusion doesn't validate the entire statement block per se, it's just
that the variables you pass in are parameters to a function and have to
exist in order to pass in.  Hence the workaround I sent before of using
evaluate().

Other languages that short circuit in if/else if/else blocks still have to
have variables defined in order to pass into functions - there's no magic
there - it just skips the rest of the block once it matches a condition
specified.  The compiler will complain if the variables aren't defined ahead
of time in languages like C, C++, Java, etc., and since you don't have the
option of compiling ColdFusion (as far as I know, anyway) to rid yourself of
errors like this, you hit the problem at run-time.  IIF does in fact short
circuit like it's supposed to.


-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 10:31 AM
To: CF-Talk
Subject: RE: IIF and DE


Not exactly.  IIF() creates an IF/ELSE scenario which, technically speaking,
could be considered two statements even though only one of them actually has
a condition defined.

Fact of the matter is, this comes down to what's called short circuit
logic.  In most languages in any if/else pair, once a match with one of the
if clauses is established, the rest of the if/else statement is simply
ignored - commonly referred to as short circuiting.  You'll find that
ColdFusion works this way with CFIF, CFELSEIF and CFELSE.  However, in the
case of IIF(), ColdFusion doesn't short circuit which means that it tries to
validate the entire statement block, even though only part of it actually
needs to execute.



---[ begin example 1 ]---
cfset strFoo = foo
cfif isDefined(strFoo) and len(trim(strFoo))
cfoutputstrFoo = #strFoo#/cfoutput
cfelse
cfoutputstrFoo2 = #strFoo2#/cfoutput
/cfif
---[ end example 1 ]---

---[ begin example 2 ]---
cfset strFoo = foo
cfoutput
#iif(isDefined(strFoo) and len(trim(strFoo)),de(strFoo),de(strFoo2))#
/cfoutput
---[ end example 2 ]---

Hope that makes sense and/or helps.  :)

-Tyson

-Original Message-
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 8:05 PM
To: CF-Talk
Subject: RE: IIF and DE


Hi,

Good idea, but I think you missed the problem.  There is not two different
expressions to evaluate to be TRUE or FALSE as in your example -- just the
isDefined function.  CF shouldn't be executing the ... blah blah blah ...,
but it does, and that is the problem.

-Brent

-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 5:57 PM
To: CF-Talk
Subject: RE: IIF and DE


This goes back to the way the old CFIF used to behave.  In the past (I
think up until CF ver 4.5), the same problem existed with CFIF.  Here's an
example.  Say that the parameter strFoo doesn't exist, consider the
following code:

cfif isDefined(strFoo) and len(trim(strFoo))
... blah blah blah ...
cfelse
... blah2 blah2 blah2 ...
/cfif

In the past, ColdFusion would choke on the CFIF statement when strFoo was
not defined, even though you'd expect it to immediately jump to the CFELSE
statement once the isDefined() returned false.  I believe this was fixed
with the release of ColdFusion 4.5 - I might be wrong on the version number.

My guess is that this behavior is still leftover in the iif() function.
I've noticed this in my own development as well that I never seem to be able
to use an isDefined() check in an iif() block.  Doing so always results in
the Error resolving parameter error.

A workaround would be to set a default for the variable using CFPARAM and
then changing your iif() logic.  Here's an example:

cfparam name=attributes.order default=
cfset orderString =
iif(len(trim(attributes.order)),de(amp;order=#attributes.order#),)
cflocation url=index.cfm?fuseaction=tools#orderString#

Hope this helps,
Tyson

-Original Message-
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 7:36 PM
To: CF-Talk
Subject: IIF and DE


Hi,

I'm trying to use IIF with DE, and it doesn't seem to be working.  My code:
cfset orderString = iif(isDefined(attributes.order),
DE(amp;order=#attributes.order#), )
cflocation url=index.cfm?fuseaction=tools#orderString#

What I am trying to do is this: if a certain variable is defined
(attributes.order), then create a string that can be appended to a URL,
otherwise make the string blank.
The desired results:
   - If attributes.order is set to name, then orderString should be set to
amp;order=name
   - If attributes.order is undefined, then orderString should be set to 

The problem is that when attributes.order is undefined, ColdFusion still
tries to execute the code that should be executed if the first expression
was true, thus giving an error.  CF is trying to find the value of
attributes.order in the DE(amp;order=#attributes.order#) statement, even
though attributes.order is undefined, and that statement should go

RE: IIF and DE

2001-08-30 Thread Tyson Vanek

Dave,

Maybe it's just me (it's still early), but I don't understand how your
example with evaluate() can be considered a workaround for a parameter that
doesn't exist.  Using the example you specified still results in the same
error.  Here was Brent's original code (the source of this whole thread):

cfset orderString =
iif(isDefined(attributes.order),DE(amp;order=#attributes.order#), )
cflocation url=index.cfm?fuseaction=tools#orderString#

If I'm understanding your workaround example correctly, here's what you're
proposing instead:

cfset orderString =
iif(isDefined(attributes.order),DE(#evaluate('amp;order=#attributes.orde
r#')#), )
cflocation url=index.cfm?fuseaction=tools#orderString#

Both of these code example produce the exact same result - Error resolving
parameter attributes.order

Am I missing something?  :)

Regards,
Tyson

-Original Message-
From: Dave Feltenberger [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 9:41 AM
To: CF-Talk
Subject: RE: IIF and DE



ColdFusion doesn't validate the entire statement block per se, it's just
that the variables you pass in are parameters to a function and have to
exist in order to pass in.  Hence the workaround I sent before of using
evaluate().

Other languages that short circuit in if/else if/else blocks still have to
have variables defined in order to pass into functions - there's no magic
there - it just skips the rest of the block once it matches a condition
specified.  The compiler will complain if the variables aren't defined ahead
of time in languages like C, C++, Java, etc., and since you don't have the
option of compiling ColdFusion (as far as I know, anyway) to rid yourself of
errors like this, you hit the problem at run-time.  IIF does in fact short
circuit like it's supposed to.


-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 10:31 AM
To: CF-Talk
Subject: RE: IIF and DE


Not exactly.  IIF() creates an IF/ELSE scenario which, technically speaking,
could be considered two statements even though only one of them actually has
a condition defined.

Fact of the matter is, this comes down to what's called short circuit
logic.  In most languages in any if/else pair, once a match with one of the
if clauses is established, the rest of the if/else statement is simply
ignored - commonly referred to as short circuiting.  You'll find that
ColdFusion works this way with CFIF, CFELSEIF and CFELSE.  However, in the
case of IIF(), ColdFusion doesn't short circuit which means that it tries to
validate the entire statement block, even though only part of it actually
needs to execute.



---[ begin example 1 ]---
cfset strFoo = foo
cfif isDefined(strFoo) and len(trim(strFoo))
cfoutputstrFoo = #strFoo#/cfoutput
cfelse
cfoutputstrFoo2 = #strFoo2#/cfoutput
/cfif
---[ end example 1 ]---

---[ begin example 2 ]---
cfset strFoo = foo
cfoutput
#iif(isDefined(strFoo) and len(trim(strFoo)),de(strFoo),de(strFoo2))#
/cfoutput
---[ end example 2 ]---

Hope that makes sense and/or helps.  :)

-Tyson

-Original Message-
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 8:05 PM
To: CF-Talk
Subject: RE: IIF and DE


Hi,

Good idea, but I think you missed the problem.  There is not two different
expressions to evaluate to be TRUE or FALSE as in your example -- just the
isDefined function.  CF shouldn't be executing the ... blah blah blah ...,
but it does, and that is the problem.

-Brent

-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 5:57 PM
To: CF-Talk
Subject: RE: IIF and DE


This goes back to the way the old CFIF used to behave.  In the past (I
think up until CF ver 4.5), the same problem existed with CFIF.  Here's an
example.  Say that the parameter strFoo doesn't exist, consider the
following code:

cfif isDefined(strFoo) and len(trim(strFoo))
... blah blah blah ...
cfelse
... blah2 blah2 blah2 ...
/cfif

In the past, ColdFusion would choke on the CFIF statement when strFoo was
not defined, even though you'd expect it to immediately jump to the CFELSE
statement once the isDefined() returned false.  I believe this was fixed
with the release of ColdFusion 4.5 - I might be wrong on the version number.

My guess is that this behavior is still leftover in the iif() function.
I've noticed this in my own development as well that I never seem to be able
to use an isDefined() check in an iif() block.  Doing so always results in
the Error resolving parameter error.

A workaround would be to set a default for the variable using CFPARAM and
then changing your iif() logic.  Here's an example:

cfparam name=attributes.order default=
cfset orderString =
iif(len(trim(attributes.order)),de(amp;order=#attributes.order#),)
cflocation url=index.cfm?fuseaction=tools#orderString#

Hope this helps,
Tyson

-Original Message-
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent

Re: IIF and DE

2001-08-30 Thread Marlon Moyer

why not just

cfparam name=attributes.order default=

at the top of the page, then do:

cfset orderString = iif(attributes.order gt ,de(#attributes.order#),
)



Marlon


- Original Message -
From: Brent Goldman [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, August 29, 2001 8:04 PM
Subject: RE: IIF and DE


 Hi,

 Good idea, but I think you missed the problem.  There is not two different
 expressions to evaluate to be TRUE or FALSE as in your example -- just the
 isDefined function.  CF shouldn't be executing the ... blah blah blah
...,
 but it does, and that is the problem.

 -Brent

 -Original Message-
 From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 29, 2001 5:57 PM
 To: CF-Talk
 Subject: RE: IIF and DE


 This goes back to the way the old CFIF used to behave.  In the past (I
 think up until CF ver 4.5), the same problem existed with CFIF.  Here's
an
 example.  Say that the parameter strFoo doesn't exist, consider the
 following code:

 cfif isDefined(strFoo) and len(trim(strFoo))
 ... blah blah blah ...
 cfelse
 ... blah2 blah2 blah2 ...
 /cfif

 In the past, ColdFusion would choke on the CFIF statement when strFoo
was
 not defined, even though you'd expect it to immediately jump to the CFELSE
 statement once the isDefined() returned false.  I believe this was fixed
 with the release of ColdFusion 4.5 - I might be wrong on the version
number.

 My guess is that this behavior is still leftover in the iif() function.
 I've noticed this in my own development as well that I never seem to be
able
 to use an isDefined() check in an iif() block.  Doing so always results in
 the Error resolving parameter error.

 A workaround would be to set a default for the variable using CFPARAM and
 then changing your iif() logic.  Here's an example:

 cfparam name=attributes.order default=
 cfset orderString =
 iif(len(trim(attributes.order)),de(amp;order=#attributes.order#),)
 cflocation url=index.cfm?fuseaction=tools#orderString#

 Hope this helps,
 Tyson

 -Original Message-
 From: Brent Goldman [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 29, 2001 7:36 PM
 To: CF-Talk
 Subject: IIF and DE


 Hi,

 I'm trying to use IIF with DE, and it doesn't seem to be working.  My
code:
 cfset orderString = iif(isDefined(attributes.order),
 DE(amp;order=#attributes.order#), )
 cflocation url=index.cfm?fuseaction=tools#orderString#

 What I am trying to do is this: if a certain variable is defined
 (attributes.order), then create a string that can be appended to a URL,
 otherwise make the string blank.
 The desired results:
- If attributes.order is set to name, then orderString should be set
to
 amp;order=name
- If attributes.order is undefined, then orderString should be set to


 The problem is that when attributes.order is undefined, ColdFusion still
 tries to execute the code that should be executed if the first expression
 was true, thus giving an error.  CF is trying to find the value of
 attributes.order in the DE(amp;order=#attributes.order#) statement,
even
 though attributes.order is undefined, and that statement should go with
 being evaluated.

 This problem is kinda hard to explain, but does anyone have any idea on
how
 to fix this??? (without having to use CFIF/CFELSE - the whole point is
that
 I want to use IIF and DE)

 Thanks
 -Brent

~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: IIF and DE

2001-08-30 Thread Dave Feltenberger

Oops.  Sorry...

It's this:

cfset temp1 = stuff

cfoutput
#evaluate(IIF(isDefined (temp1), DE(temp1), DE(temp2)))#
/cfoutput

The evaluate goes around the IIF instead of around the variable names (I
didn't think it through well enough before I sent out the message).

Now that's assuming that the other variables *is* defined, of course.  The
IIF still does delayed evaluation correctly though, it's just that many
ColdFusion programmers have a skewed view of what delayed evaluation is and
how it should work.


-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 11:06 AM
To: CF-Talk
Subject: RE: IIF and DE


Dave,

Maybe it's just me (it's still early), but I don't understand how your
example with evaluate() can be considered a workaround for a parameter that
doesn't exist.  Using the example you specified still results in the same
error.  Here was Brent's original code (the source of this whole thread):

cfset orderString =
iif(isDefined(attributes.order),DE(amp;order=#attributes.order#), )
cflocation url=index.cfm?fuseaction=tools#orderString#

If I'm understanding your workaround example correctly, here's what you're
proposing instead:

cfset orderString =
iif(isDefined(attributes.order),DE(#evaluate('amp;order=#attributes.orde
r#')#), )
cflocation url=index.cfm?fuseaction=tools#orderString#

Both of these code example produce the exact same result - Error resolving
parameter attributes.order

Am I missing something?  :)

Regards,
Tyson

-Original Message-
From: Dave Feltenberger [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 9:41 AM
To: CF-Talk
Subject: RE: IIF and DE



ColdFusion doesn't validate the entire statement block per se, it's just
that the variables you pass in are parameters to a function and have to
exist in order to pass in.  Hence the workaround I sent before of using
evaluate().

Other languages that short circuit in if/else if/else blocks still have to
have variables defined in order to pass into functions - there's no magic
there - it just skips the rest of the block once it matches a condition
specified.  The compiler will complain if the variables aren't defined ahead
of time in languages like C, C++, Java, etc., and since you don't have the
option of compiling ColdFusion (as far as I know, anyway) to rid yourself of
errors like this, you hit the problem at run-time.  IIF does in fact short
circuit like it's supposed to.


-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 10:31 AM
To: CF-Talk
Subject: RE: IIF and DE


Not exactly.  IIF() creates an IF/ELSE scenario which, technically speaking,
could be considered two statements even though only one of them actually has
a condition defined.

Fact of the matter is, this comes down to what's called short circuit
logic.  In most languages in any if/else pair, once a match with one of the
if clauses is established, the rest of the if/else statement is simply
ignored - commonly referred to as short circuiting.  You'll find that
ColdFusion works this way with CFIF, CFELSEIF and CFELSE.  However, in the
case of IIF(), ColdFusion doesn't short circuit which means that it tries to
validate the entire statement block, even though only part of it actually
needs to execute.



---[ begin example 1 ]---
cfset strFoo = foo
cfif isDefined(strFoo) and len(trim(strFoo))
cfoutputstrFoo = #strFoo#/cfoutput
cfelse
cfoutputstrFoo2 = #strFoo2#/cfoutput
/cfif
---[ end example 1 ]---

---[ begin example 2 ]---
cfset strFoo = foo
cfoutput
#iif(isDefined(strFoo) and len(trim(strFoo)),de(strFoo),de(strFoo2))#
/cfoutput
---[ end example 2 ]---

Hope that makes sense and/or helps.  :)

-Tyson

-Original Message-
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 8:05 PM
To: CF-Talk
Subject: RE: IIF and DE


Hi,

Good idea, but I think you missed the problem.  There is not two different
expressions to evaluate to be TRUE or FALSE as in your example -- just the
isDefined function.  CF shouldn't be executing the ... blah blah blah ...,
but it does, and that is the problem.

-Brent

-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 5:57 PM
To: CF-Talk
Subject: RE: IIF and DE


This goes back to the way the old CFIF used to behave.  In the past (I
think up until CF ver 4.5), the same problem existed with CFIF.  Here's an
example.  Say that the parameter strFoo doesn't exist, consider the
following code:

cfif isDefined(strFoo) and len(trim(strFoo))
... blah blah blah ...
cfelse
... blah2 blah2 blah2 ...
/cfif

In the past, ColdFusion would choke on the CFIF statement when strFoo was
not defined, even though you'd expect it to immediately jump to the CFELSE
statement once the isDefined() returned false.  I believe this was fixed
with the release of ColdFusion 4.5 - I might be wrong on the version number.

My guess

RE: IIF and DE

2001-08-30 Thread Brent Goldman

Hi,

Yes, that WILL work, but the second statement in the IIF statement is not
just a variable, but a string that uses the variable WITHIN.  That's the
problem.

-Brent

-Original Message-
From: Dave Feltenberger [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 8:26 AM
To: CF-Talk
Subject: RE: IIF and DE


Oops.  Sorry...

It's this:

cfset temp1 = stuff

cfoutput
#evaluate(IIF(isDefined (temp1), DE(temp1), DE(temp2)))#
/cfoutput

The evaluate goes around the IIF instead of around the variable names (I
didn't think it through well enough before I sent out the message).

Now that's assuming that the other variables *is* defined, of course.  The
IIF still does delayed evaluation correctly though, it's just that many
ColdFusion programmers have a skewed view of what delayed evaluation is and
how it should work.


-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 11:06 AM
To: CF-Talk
Subject: RE: IIF and DE


Dave,

Maybe it's just me (it's still early), but I don't understand how your
example with evaluate() can be considered a workaround for a parameter that
doesn't exist.  Using the example you specified still results in the same
error.  Here was Brent's original code (the source of this whole thread):

cfset orderString =
iif(isDefined(attributes.order),DE(amp;order=#attributes.order#), )
cflocation url=index.cfm?fuseaction=tools#orderString#

If I'm understanding your workaround example correctly, here's what you're
proposing instead:

cfset orderString =
iif(isDefined(attributes.order),DE(#evaluate('amp;order=#attributes.orde
r#')#), )
cflocation url=index.cfm?fuseaction=tools#orderString#

Both of these code example produce the exact same result - Error resolving
parameter attributes.order

Am I missing something?  :)

Regards,
Tyson

-Original Message-
From: Dave Feltenberger [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 9:41 AM
To: CF-Talk
Subject: RE: IIF and DE



ColdFusion doesn't validate the entire statement block per se, it's just
that the variables you pass in are parameters to a function and have to
exist in order to pass in.  Hence the workaround I sent before of using
evaluate().

Other languages that short circuit in if/else if/else blocks still have to
have variables defined in order to pass into functions - there's no magic
there - it just skips the rest of the block once it matches a condition
specified.  The compiler will complain if the variables aren't defined ahead
of time in languages like C, C++, Java, etc., and since you don't have the
option of compiling ColdFusion (as far as I know, anyway) to rid yourself of
errors like this, you hit the problem at run-time.  IIF does in fact short
circuit like it's supposed to.


-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 10:31 AM
To: CF-Talk
Subject: RE: IIF and DE


Not exactly.  IIF() creates an IF/ELSE scenario which, technically speaking,
could be considered two statements even though only one of them actually has
a condition defined.

Fact of the matter is, this comes down to what's called short circuit
logic.  In most languages in any if/else pair, once a match with one of the
if clauses is established, the rest of the if/else statement is simply
ignored - commonly referred to as short circuiting.  You'll find that
ColdFusion works this way with CFIF, CFELSEIF and CFELSE.  However, in the
case of IIF(), ColdFusion doesn't short circuit which means that it tries to
validate the entire statement block, even though only part of it actually
needs to execute.



---[ begin example 1 ]---
cfset strFoo = foo
cfif isDefined(strFoo) and len(trim(strFoo))
cfoutputstrFoo = #strFoo#/cfoutput
cfelse
cfoutputstrFoo2 = #strFoo2#/cfoutput
/cfif
---[ end example 1 ]---

---[ begin example 2 ]---
cfset strFoo = foo
cfoutput
#iif(isDefined(strFoo) and len(trim(strFoo)),de(strFoo),de(strFoo2))#
/cfoutput
---[ end example 2 ]---

Hope that makes sense and/or helps.  :)

-Tyson

-Original Message-
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 8:05 PM
To: CF-Talk
Subject: RE: IIF and DE


Hi,

Good idea, but I think you missed the problem.  There is not two different
expressions to evaluate to be TRUE or FALSE as in your example -- just the
isDefined function.  CF shouldn't be executing the ... blah blah blah ...,
but it does, and that is the problem.

-Brent

-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 5:57 PM
To: CF-Talk
Subject: RE: IIF and DE


This goes back to the way the old CFIF used to behave.  In the past (I
think up until CF ver 4.5), the same problem existed with CFIF.  Here's an
example.  Say that the parameter strFoo doesn't exist, consider the
following code:

cfif isDefined(strFoo) and len(trim(strFoo))
... blah blah blah ...
cfelse
... blah2 blah2

RE: IIF and DE

2001-08-30 Thread Dave Feltenberger

I'd suggest writing your code in a different way - what you're trying to do
(i.e. the way you're doing it) isn't possible.

 -Original Message-
 From: Brent Goldman [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 6:41 PM
 To: CF-Talk
 Subject: RE: IIF and DE


 Hi,

 Yes, that WILL work, but the second statement in the IIF statement is not
 just a variable, but a string that uses the variable WITHIN.  That's the
 problem.

 -Brent

 -Original Message-
 From: Dave Feltenberger [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 8:26 AM
 To: CF-Talk
 Subject: RE: IIF and DE


 Oops.  Sorry...

 It's this:

 cfset temp1 = stuff

 cfoutput
 #evaluate(IIF(isDefined (temp1), DE(temp1), DE(temp2)))#
 /cfoutput

 The evaluate goes around the IIF instead of around the variable names (I
 didn't think it through well enough before I sent out the message).

 Now that's assuming that the other variables *is* defined, of course.  The
 IIF still does delayed evaluation correctly though, it's just that many
 ColdFusion programmers have a skewed view of what delayed
 evaluation is and
 how it should work.


 -Original Message-
 From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 11:06 AM
 To: CF-Talk
 Subject: RE: IIF and DE


 Dave,

 Maybe it's just me (it's still early), but I don't understand how your
 example with evaluate() can be considered a workaround for a
 parameter that
 doesn't exist.  Using the example you specified still results in the same
 error.  Here was Brent's original code (the source of this whole thread):

 cfset orderString =
 iif(isDefined(attributes.order),DE(amp;order=#attributes.order
 #), )
 cflocation url=index.cfm?fuseaction=tools#orderString#

 If I'm understanding your workaround example correctly, here's what you're
 proposing instead:

 cfset orderString =
 iif(isDefined(attributes.order),DE(#evaluate('amp;order=#attri
 butes.orde
 r#')#), )
 cflocation url=index.cfm?fuseaction=tools#orderString#

 Both of these code example produce the exact same result - Error
 resolving
 parameter attributes.order

 Am I missing something?  :)

 Regards,
 Tyson

 -Original Message-
 From: Dave Feltenberger [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 9:41 AM
 To: CF-Talk
 Subject: RE: IIF and DE



 ColdFusion doesn't validate the entire statement block per se, it's just
 that the variables you pass in are parameters to a function and have to
 exist in order to pass in.  Hence the workaround I sent before of using
 evaluate().

 Other languages that short circuit in if/else if/else blocks
 still have to
 have variables defined in order to pass into functions - there's no magic
 there - it just skips the rest of the block once it matches a condition
 specified.  The compiler will complain if the variables aren't
 defined ahead
 of time in languages like C, C++, Java, etc., and since you don't have the
 option of compiling ColdFusion (as far as I know, anyway) to rid
 yourself of
 errors like this, you hit the problem at run-time.  IIF does in
 fact short
 circuit like it's supposed to.


 -Original Message-
 From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 10:31 AM
 To: CF-Talk
 Subject: RE: IIF and DE


 Not exactly.  IIF() creates an IF/ELSE scenario which,
 technically speaking,
 could be considered two statements even though only one of them
 actually has
 a condition defined.

 Fact of the matter is, this comes down to what's called short circuit
 logic.  In most languages in any if/else pair, once a match with
 one of the
 if clauses is established, the rest of the if/else statement is simply
 ignored - commonly referred to as short circuiting.  You'll find that
 ColdFusion works this way with CFIF, CFELSEIF and CFELSE.  However, in the
 case of IIF(), ColdFusion doesn't short circuit which means that
 it tries to
 validate the entire statement block, even though only part of it actually
 needs to execute.



 ---[ begin example 1 ]---
 cfset strFoo = foo
 cfif isDefined(strFoo) and len(trim(strFoo))
   cfoutputstrFoo = #strFoo#/cfoutput
 cfelse
   cfoutputstrFoo2 = #strFoo2#/cfoutput
 /cfif
 ---[ end example 1 ]---

 ---[ begin example 2 ]---
 cfset strFoo = foo
 cfoutput
   #iif(isDefined(strFoo) and
 len(trim(strFoo)),de(strFoo),de(strFoo2))#
 /cfoutput
 ---[ end example 2 ]---

 Hope that makes sense and/or helps.  :)

 -Tyson

 -Original Message-
 From: Brent Goldman [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 29, 2001 8:05 PM
 To: CF-Talk
 Subject: RE: IIF and DE


 Hi,

 Good idea, but I think you missed the problem.  There is not two different
 expressions to evaluate to be TRUE or FALSE as in your example -- just the
 isDefined function.  CF shouldn't be executing the ... blah blah
 blah ...,
 but it does, and that is the problem.

 -Brent

 -Original Message-
 From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday

RE: IIF and DE

2001-08-30 Thread Brent Goldman

Hi,

Actually, it is possible.  I just got it to work earlier today.  The code is
below:

cfset orderString = iif(isDefined(attributes.order), 'amp;order=' 
attributes.order, DE())

Try it - it works.

-Brent

-Original Message-
From: Dave Feltenberger [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 30, 2001 6:08 PM
To: CF-Talk
Subject: RE: IIF and DE


I'd suggest writing your code in a different way - what you're trying to do
(i.e. the way you're doing it) isn't possible.

 -Original Message-
 From: Brent Goldman [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 6:41 PM
 To: CF-Talk
 Subject: RE: IIF and DE


 Hi,

 Yes, that WILL work, but the second statement in the IIF statement is not
 just a variable, but a string that uses the variable WITHIN.  That's the
 problem.

 -Brent

 -Original Message-
 From: Dave Feltenberger [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 8:26 AM
 To: CF-Talk
 Subject: RE: IIF and DE


 Oops.  Sorry...

 It's this:

 cfset temp1 = stuff

 cfoutput
 #evaluate(IIF(isDefined (temp1), DE(temp1), DE(temp2)))#
 /cfoutput

 The evaluate goes around the IIF instead of around the variable names (I
 didn't think it through well enough before I sent out the message).

 Now that's assuming that the other variables *is* defined, of course.  The
 IIF still does delayed evaluation correctly though, it's just that many
 ColdFusion programmers have a skewed view of what delayed
 evaluation is and
 how it should work.


 -Original Message-
 From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 11:06 AM
 To: CF-Talk
 Subject: RE: IIF and DE


 Dave,

 Maybe it's just me (it's still early), but I don't understand how your
 example with evaluate() can be considered a workaround for a
 parameter that
 doesn't exist.  Using the example you specified still results in the same
 error.  Here was Brent's original code (the source of this whole thread):

 cfset orderString =
 iif(isDefined(attributes.order),DE(amp;order=#attributes.order
 #), )
 cflocation url=index.cfm?fuseaction=tools#orderString#

 If I'm understanding your workaround example correctly, here's what you're
 proposing instead:

 cfset orderString =
 iif(isDefined(attributes.order),DE(#evaluate('amp;order=#attri
 butes.orde
 r#')#), )
 cflocation url=index.cfm?fuseaction=tools#orderString#

 Both of these code example produce the exact same result - Error
 resolving
 parameter attributes.order

 Am I missing something?  :)

 Regards,
 Tyson

 -Original Message-
 From: Dave Feltenberger [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 9:41 AM
 To: CF-Talk
 Subject: RE: IIF and DE



 ColdFusion doesn't validate the entire statement block per se, it's just
 that the variables you pass in are parameters to a function and have to
 exist in order to pass in.  Hence the workaround I sent before of using
 evaluate().

 Other languages that short circuit in if/else if/else blocks
 still have to
 have variables defined in order to pass into functions - there's no magic
 there - it just skips the rest of the block once it matches a condition
 specified.  The compiler will complain if the variables aren't
 defined ahead
 of time in languages like C, C++, Java, etc., and since you don't have the
 option of compiling ColdFusion (as far as I know, anyway) to rid
 yourself of
 errors like this, you hit the problem at run-time.  IIF does in
 fact short
 circuit like it's supposed to.


 -Original Message-
 From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 30, 2001 10:31 AM
 To: CF-Talk
 Subject: RE: IIF and DE


 Not exactly.  IIF() creates an IF/ELSE scenario which,
 technically speaking,
 could be considered two statements even though only one of them
 actually has
 a condition defined.

 Fact of the matter is, this comes down to what's called short circuit
 logic.  In most languages in any if/else pair, once a match with
 one of the
 if clauses is established, the rest of the if/else statement is simply
 ignored - commonly referred to as short circuiting.  You'll find that
 ColdFusion works this way with CFIF, CFELSEIF and CFELSE.  However, in the
 case of IIF(), ColdFusion doesn't short circuit which means that
 it tries to
 validate the entire statement block, even though only part of it actually
 needs to execute.



 ---[ begin example 1 ]---
 cfset strFoo = foo
 cfif isDefined(strFoo) and len(trim(strFoo))
   cfoutputstrFoo = #strFoo#/cfoutput
 cfelse
   cfoutputstrFoo2 = #strFoo2#/cfoutput
 /cfif
 ---[ end example 1 ]---

 ---[ begin example 2 ]---
 cfset strFoo = foo
 cfoutput
   #iif(isDefined(strFoo) and
 len(trim(strFoo)),de(strFoo),de(strFoo2))#
 /cfoutput
 ---[ end example 2 ]---

 Hope that makes sense and/or helps.  :)

 -Tyson

 -Original Message-
 From: Brent Goldman [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, August 29, 2001 8:05 PM
 To: CF-Talk
 Subject: RE: IIF and DE


 Hi

RE: IIF and DE

2001-08-29 Thread Tyson Vanek

This goes back to the way the old CFIF used to behave.  In the past (I
think up until CF ver 4.5), the same problem existed with CFIF.  Here's an
example.  Say that the parameter strFoo doesn't exist, consider the
following code:

cfif isDefined(strFoo) and len(trim(strFoo))
... blah blah blah ...
cfelse
... blah2 blah2 blah2 ...
/cfif

In the past, ColdFusion would choke on the CFIF statement when strFoo was
not defined, even though you'd expect it to immediately jump to the CFELSE
statement once the isDefined() returned false.  I believe this was fixed
with the release of ColdFusion 4.5 - I might be wrong on the version number.

My guess is that this behavior is still leftover in the iif() function.
I've noticed this in my own development as well that I never seem to be able
to use an isDefined() check in an iif() block.  Doing so always results in
the Error resolving parameter error.

A workaround would be to set a default for the variable using CFPARAM and
then changing your iif() logic.  Here's an example:

cfparam name=attributes.order default=
cfset orderString =
iif(len(trim(attributes.order)),de(amp;order=#attributes.order#),)
cflocation url=index.cfm?fuseaction=tools#orderString#

Hope this helps,
Tyson

-Original Message-
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 7:36 PM
To: CF-Talk
Subject: IIF and DE


Hi,

I'm trying to use IIF with DE, and it doesn't seem to be working.  My code:
cfset orderString = iif(isDefined(attributes.order),
DE(amp;order=#attributes.order#), )
cflocation url=index.cfm?fuseaction=tools#orderString#

What I am trying to do is this: if a certain variable is defined
(attributes.order), then create a string that can be appended to a URL,
otherwise make the string blank.
The desired results:
   - If attributes.order is set to name, then orderString should be set to
amp;order=name
   - If attributes.order is undefined, then orderString should be set to 

The problem is that when attributes.order is undefined, ColdFusion still
tries to execute the code that should be executed if the first expression
was true, thus giving an error.  CF is trying to find the value of
attributes.order in the DE(amp;order=#attributes.order#) statement, even
though attributes.order is undefined, and that statement should go with
being evaluated.

This problem is kinda hard to explain, but does anyone have any idea on how
to fix this??? (without having to use CFIF/CFELSE - the whole point is that
I want to use IIF and DE)

Thanks
-Brent
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: IIF and DE

2001-08-29 Thread Brent Goldman

Hi,

Good idea, but I think you missed the problem.  There is not two different
expressions to evaluate to be TRUE or FALSE as in your example -- just the
isDefined function.  CF shouldn't be executing the ... blah blah blah ...,
but it does, and that is the problem.

-Brent

-Original Message-
From: Tyson Vanek [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 5:57 PM
To: CF-Talk
Subject: RE: IIF and DE


This goes back to the way the old CFIF used to behave.  In the past (I
think up until CF ver 4.5), the same problem existed with CFIF.  Here's an
example.  Say that the parameter strFoo doesn't exist, consider the
following code:

cfif isDefined(strFoo) and len(trim(strFoo))
... blah blah blah ...
cfelse
... blah2 blah2 blah2 ...
/cfif

In the past, ColdFusion would choke on the CFIF statement when strFoo was
not defined, even though you'd expect it to immediately jump to the CFELSE
statement once the isDefined() returned false.  I believe this was fixed
with the release of ColdFusion 4.5 - I might be wrong on the version number.

My guess is that this behavior is still leftover in the iif() function.
I've noticed this in my own development as well that I never seem to be able
to use an isDefined() check in an iif() block.  Doing so always results in
the Error resolving parameter error.

A workaround would be to set a default for the variable using CFPARAM and
then changing your iif() logic.  Here's an example:

cfparam name=attributes.order default=
cfset orderString =
iif(len(trim(attributes.order)),de(amp;order=#attributes.order#),)
cflocation url=index.cfm?fuseaction=tools#orderString#

Hope this helps,
Tyson

-Original Message-
From: Brent Goldman [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 7:36 PM
To: CF-Talk
Subject: IIF and DE


Hi,

I'm trying to use IIF with DE, and it doesn't seem to be working.  My code:
cfset orderString = iif(isDefined(attributes.order),
DE(amp;order=#attributes.order#), )
cflocation url=index.cfm?fuseaction=tools#orderString#

What I am trying to do is this: if a certain variable is defined
(attributes.order), then create a string that can be appended to a URL,
otherwise make the string blank.
The desired results:
   - If attributes.order is set to name, then orderString should be set to
amp;order=name
   - If attributes.order is undefined, then orderString should be set to 

The problem is that when attributes.order is undefined, ColdFusion still
tries to execute the code that should be executed if the first expression
was true, thus giving an error.  CF is trying to find the value of
attributes.order in the DE(amp;order=#attributes.order#) statement, even
though attributes.order is undefined, and that statement should go with
being evaluated.

This problem is kinda hard to explain, but does anyone have any idea on how
to fix this??? (without having to use CFIF/CFELSE - the whole point is that
I want to use IIF and DE)

Thanks
-Brent
~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: IIf() and DE confusion

2000-07-10 Thread Bryan Batchelder

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--_=_NextPart_001_01BFEAAC.DB4262B0
Content-Type: text/plain;
charset="iso-8859-1"

shouldn't this work?:

iif(IsDate(form.thedate), DE(#CreateODBCDate(form.thedate)#), DE(""))

--b

p.s.  if you ever think you have it badhere is an iif that took a few
hours of my time and about 15 minutes of a colleagues:

iif(query.red_flag[rowNbr], DE(caller.pqa  '/redflag.gif'),
iif(query.close_flag[rowNbr], ""DE(iif(query.won_flag[rowNbr], DE(caller.pqa
 '/thumbs_up.gif'), DE(caller.pqa  '/thumbs_down.gif')))"",
""DE(caller.pqa  '/transpix.gif')""))

Laterz.


Bryan D. Batchelder   Work: 813-935-7100
Palm/Internet Developer   Home: 727-547-1322

ConnectWise, Inc. (www.ConnectWise.com)
2803 West Busch Blvd, Suite 204
Tampa, FL 33618


-Original Message-
From: Jim McAtee [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 10, 2000 4:15 PM
To: [EMAIL PROTECTED]
Subject: IIf() and DE confusion


I know this can be done, but I'll be hanged if I can figure out the right
combination of DE() and ## and quotes and whatever else might be needed.
I'm trying to use IIf() in a SQL statement instead of the following:

thedate = cfif
IsDate(form.thedate)#CreateODBCDate(form.thedate)#cfelseNULL/cfif

Thanks,
Jim



--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

--_=_NextPart_001_01BFEAAC.DB4262B0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"
HTML
HEAD
META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1"
META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12"
TITLERE: IIf() and DE confusion/TITLE
/HEAD
BODY

PFONT SIZE=3D2shouldn't this work?:/FONT
/P

PFONT SIZE=3D2iif(IsDate(form.thedate), =
DE(#CreateODBCDate(form.thedate)#), DE(quot;quot;))/FONT
/P

PFONT SIZE=3D2--b/FONT
/P

PFONT SIZE=3D2p.s.nbsp; if you ever think you have it badhere =
is an iif that took a few hours of my time and about 15 minutes of a =
colleagues:/FONT/P

PFONT SIZE=3D2iif(query.red_flag[rowNbr], DE(caller.pqa amp; =
'/redflag.gif'), iif(query.close_flag[rowNbr], =
quot;quot;DE(iif(query.won_flag[rowNbr], DE(caller.pqa amp; =
'/thumbs_up.gif'), DE(caller.pqa amp; =
'/thumbs_down.gif')))quot;quot;, quot;quot;DE(caller.pqa amp; =
'/transpix.gif')quot;quot;))/FONT/P

PFONT SIZE=3D2Laterz./FONT
/P

PFONT SIZE=3D2/FONT
BRFONT SIZE=3D2Bryan D. =
Batcheldernbsp;nbsp;nbsp;nbsp;nbsp;nbsp; Work: =
813-935-7100/FONT
BRFONT SIZE=3D2Palm/Internet Developernbsp;nbsp; Home: =
727-547-1322/FONT
BRFONT SIZE=3D2/FONT
BRFONT SIZE=3D2ConnectWise, Inc. (www.ConnectWise.com)/FONT
BRFONT SIZE=3D22803 West Busch Blvd, Suite 204/FONT
BRFONT SIZE=3D2Tampa, FL 33618/FONT
BRFONT SIZE=3D2/FONT
/P

PFONT SIZE=3D2-Original Message-/FONT
BRFONT SIZE=3D2From: Jim McAtee [A =
HREF=3D"mailto:[EMAIL PROTECTED]"mailto:[EMAIL PROTECTED]=
/A]/FONT
BRFONT SIZE=3D2Sent: Monday, July 10, 2000 4:15 PM/FONT
BRFONT SIZE=3D2To: [EMAIL PROTECTED]/FONT
BRFONT SIZE=3D2Subject: IIf() and DE confusion/FONT
/P
BR

PFONT SIZE=3D2I know this can be done, but I'll be hanged if I can =
figure out the right/FONT
BRFONT SIZE=3D2combination of DE() and ## and quotes and whatever =
else might be needed./FONT
BRFONT SIZE=3D2I'm trying to use IIf() in a SQL statement instead =
of the following:/FONT
/P

PFONT SIZE=3D2thedate =3D lt;cfif/FONT
BRFONT =
SIZE=3D2IsDate(form.thedate)gt;#CreateODBCDate(form.thedate)#lt;cfels=
egt;NULLlt;/cfifgt;/FONT
/P

PFONT SIZE=3D2Thanks,/FONT
BRFONT SIZE=3D2Jim/FONT
/P
BR

PFONT =
SIZE=3D2---=
---/FONT
BRFONT SIZE=3D2Archives: A =
HREF=3D"http://www.mail-archive.com/cf-talk@houseoffusion.com/" =
TARGET=3D"_blank"http://www.mail-archive.com/cf-talk@houseoffusion.com/=
/A/FONT
BRFONT SIZE=3D2To Unsubscribe visit A =
HREF=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlistsbody=3Dli=
sts/cf_talk" =
TARGET=3D"_blank"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists=
body=3Dlists/cf_talk/A or send a message to =
[EMAIL PROTECTED] with 'unsubscribe' in the =
body./FONT/P

/BODY
/HTML
--_=_NextPart_001_01BFEAAC.DB4262B0--
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To 

Re: IIf() and DE confusion

2000-07-10 Thread Jim McAtee

Nope, if left blank, CF tries to evaluate CreateODBCDate() and generates
an error:

Error Diagnostic Information
Parameter 1 of function CreateODBCDate which is now "" must be a date/time
value

Jim


-Original Message-
From: Bryan Batchelder [EMAIL PROTECTED]
To: '[EMAIL PROTECTED]' [EMAIL PROTECTED]
Date: Monday, July 10, 2000 2:25 PM
Subject: RE: IIf() and DE confusion


This message is in MIME format. Since your mail reader does not
understand
this format, some or all of this message may not be legible.

--_=_NextPart_001_01BFEAAC.DB4262B0
Content-Type: text/plain;
 charset="iso-8859-1"

shouldn't this work?:

iif(IsDate(form.thedate), DE(#CreateODBCDate(form.thedate)#), DE(""))

--b

p.s.  if you ever think you have it badhere is an iif that took a few
hours of my time and about 15 minutes of a colleagues:

iif(query.red_flag[rowNbr], DE(caller.pqa  '/redflag.gif'),
iif(query.close_flag[rowNbr], ""DE(iif(query.won_flag[rowNbr],
DE(caller.pqa
 '/thumbs_up.gif'), DE(caller.pqa  '/thumbs_down.gif')))"",
""DE(caller.pqa  '/transpix.gif')""))

Laterz.


Bryan D. Batchelder   Work: 813-935-7100
Palm/Internet Developer   Home: 727-547-1322

ConnectWise, Inc. (www.ConnectWise.com)
2803 West Busch Blvd, Suite 204
Tampa, FL 33618


-Original Message-
From: Jim McAtee [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 10, 2000 4:15 PM
To: [EMAIL PROTECTED]
Subject: IIf() and DE confusion


I know this can be done, but I'll be hanged if I can figure out the right
combination of DE() and ## and quotes and whatever else might be needed.
I'm trying to use IIf() in a SQL statement instead of the following:

thedate = cfif
IsDate(form.thedate)#CreateODBCDate(form.thedate)#cfelseNULL/cfif

Thanks,
Jim

--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: IIf() and DE confusion

2000-07-10 Thread Michael Dinowitz

#IIF(IsDate(form.thedate), 'CreateODBCDate(form.thedate)', '''NULL''')#

Note the use of single and multiple quotes here in place of DE. Using DE
instead will look like one of these:

#IIF(IsDate(form.thedate), 'CreateODBCDate(form.thedate)', DE('NULL'))#
#IIF(IsDate(form.thedate), DE(CreateODBCDate(form.thedate)), DE('NULL'))#

More information on this can be found here:
http://www.fusionauthority.com/IIF.cfm


 I know this can be done, but I'll be hanged if I can figure out the right
 combination of DE() and ## and quotes and whatever else might be needed.
 I'm trying to use IIf() in a SQL statement instead of the following:

 thedate = cfif
 IsDate(form.thedate)#CreateODBCDate(form.thedate)#cfelseNULL/cfif

 Thanks,
 Jim


 --

 Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
 To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: IIf() and DE confusion

2000-07-10 Thread Michael Dinowitz

Sorry, missed the use in the wrap. The code would actually be:
CFSET thedate=IIF(IsDate(form.thedate), 'CreateODBCDate(form.thedate)',
'''NULL''')
or
CFSET thedate=IIF(IsDate(form.thedate), 'CreateODBCDate(form.thedate)',
DE('NULL'))
CFSET thedate=IIF(IsDate(form.thedate), DE(CreateODBCDate(form.thedate)),
DE('NULL'))

More information on this can be found here:
http://www.fusionauthority.com/IIF.cfm


 I know this can be done, but I'll be hanged if I can figure out the right
 combination of DE() and ## and quotes and whatever else might be needed.
 I'm trying to use IIf() in a SQL statement instead of the following:

 thedate = cfif
 IsDate(form.thedate)#CreateODBCDate(form.thedate)#cfelseNULL/cfif

 Thanks,
 Jim


 --

 Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
 To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.



--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: IIf() and DE confusion

2000-07-10 Thread Jim McAtee

Thanks, Michael.  The first two approaches work correctly, but the third
doesn't.  It throws an error as it tries to evaluate CreateODBCDate() if
the field is left blank.

Jim


-Original Message-
From: Michael Dinowitz [EMAIL PROTECTED]
To: [EMAIL PROTECTED] [EMAIL PROTECTED]
Date: Monday, July 10, 2000 3:16 PM
Subject: Re: IIf() and DE confusion


#IIF(IsDate(form.thedate), 'CreateODBCDate(form.thedate)', '''NULL''')#

Note the use of single and multiple quotes here in place of DE. Using DE
instead will look like one of these:

#IIF(IsDate(form.thedate), 'CreateODBCDate(form.thedate)', DE('NULL'))#
#IIF(IsDate(form.thedate), DE(CreateODBCDate(form.thedate)), DE('NULL'))#

More information on this can be found here:
http://www.fusionauthority.com/IIF.cfm


 I know this can be done, but I'll be hanged if I can figure out the
right
 combination of DE() and ## and quotes and whatever else might be
needed.
 I'm trying to use IIf() in a SQL statement instead of the following:

 thedate = cfif
 IsDate(form.thedate)#CreateODBCDate(form.thedate)#cfelseNULL/cfif

 Thanks,
 Jim


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.



Re: IIf() and DE confusion

2000-07-10 Thread Michael Dinowitz

True, it would. The problem with IIF is that its a function. Before a
function evaluates, any subfunctions AND variables  inside it are evaluated.
When using the DE functions, it tried to evaluate what was in it, which was
a function. This failed, causing the whole thing to fail. This is the reason
I prefer to use quotes in place of DE functions. Saves the problems.

 Thanks, Michael.  The first two approaches work correctly, but the third
 doesn't.  It throws an error as it tries to evaluate CreateODBCDate() if
 the field is left blank.

 Jim


 -Original Message-
 From: Michael Dinowitz [EMAIL PROTECTED]
 To: [EMAIL PROTECTED] [EMAIL PROTECTED]
 Date: Monday, July 10, 2000 3:16 PM
 Subject: Re: IIf() and DE confusion


 #IIF(IsDate(form.thedate), 'CreateODBCDate(form.thedate)', '''NULL''')#
 
 Note the use of single and multiple quotes here in place of DE. Using DE
 instead will look like one of these:
 
 #IIF(IsDate(form.thedate), 'CreateODBCDate(form.thedate)', DE('NULL'))#
 #IIF(IsDate(form.thedate), DE(CreateODBCDate(form.thedate)), DE('NULL'))#
 
 More information on this can be found here:
 http://www.fusionauthority.com/IIF.cfm
 
 
  I know this can be done, but I'll be hanged if I can figure out the
 right
  combination of DE() and ## and quotes and whatever else might be
 needed.
  I'm trying to use IIf() in a SQL statement instead of the following:
 
  thedate = cfif
  IsDate(form.thedate)#CreateODBCDate(form.thedate)#cfelseNULL/cfif
 
  Thanks,
  Jim


 --

 Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
 To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.