First better way: Don't use strings for booleans!
Second better way: Don't write "if True then True else False"!
(parenthesis are unnecessary here, but I feel they make it more readable)
Third better way: Don't use cfform!
(that's from my form custom tag library, not yet released)
:)
> I'm
checked="#something eq 'somethingelse#"
That should work just fine. No need for the iff() in this case.
On 3/23/07, Richard Cooper <[EMAIL PROTECTED]> wrote:
>
> I'm assuming there is a noticeable difference in using IFF? Recently I've
> been using it quite heavily in forms now i.e.
>
> checked
I'm assuming there is a noticeable difference in using IFF? Recently I've been
using it quite heavily in forms now i.e.
Are there better ways of doing this?
~|
ColdFusion MX7 by AdobeĀ®
Dyncamically transform webcontent into A
t; To: CF-Talk
> Subject: Just a tidbit for those who might not have use iif before
>
> I have never really used iif before, I was aware it existed but didn't
> really see a good place for it. Until today. =)
>
> Check this out:
>
> dollarformat(iif(Cost, cost, 0))
&
> dollarformat(iif(Cost, cost, 0))
You could also use the val() function around the cost variable to do the
same thing more efficiently. It will also correct for unexpected
non-integer characters in the variable as well. I've found that in
almost any situation where iif() looks like it's needed,
Quick, someone find a way to make that need an evaluate().
-Original Message-
From: Andy Matthews [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 22, 2007 4:17 PM
To: CF-Talk
Subject: RE: Just a tidbit for those who might not have use iif before
Here come the Iif police.
-Original
and about whether Cost is truly a Boolean...
-Original Message-
From: Rob Wilkerson [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 22, 2007 3:15 PM
To: CF-Talk
Subject: Re: Just a tidbit for those who might not have use iif before
Uh oh. You're probably about to get hammered
Here come the Iif police.
-Original Message-
From: Peterson, Chris [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 22, 2007 3:10 PM
To: CF-Talk
Subject: Just a tidbit for those who might not have use iif before
I have never really used iif before, I was aware it existed but didn
Uh oh. You're probably about to get hammered with responses related to the
performance cost...
On 3/22/07, Peterson, Chris <[EMAIL PROTECTED]> wrote:
>
> I have never really used iif before, I was aware it existed but didn't
> really see a good place for it. Until today. =)
>
> Check this out:
>
I have never really used iif before, I was aware it existed but didn't
really see a good place for it. Until today. =)
Check this out:
dollarformat(iif(Cost, cost, 0))
That says, evaluate cost as a Boolean, if its true (anything but 0 or
null) then return cost, otherwise return 0 (so the dollar
10 matches
Mail list logo