Re: Just a tidbit for those who might not have use iif before
I'm assuming there is a noticeable difference in using IFF? Recently I've been using it quite heavily in forms now i.e. cfinput type=radio name=myField id=myField value=myValue checked=#IIF(something eq 'somethingelse', DE('Yes'), DE('No'))# / Are there better ways of doing this? ~| ColdFusion MX7 by Adobe® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273488 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Just a tidbit for those who might not have use iif before
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. cfinput type=radio name=myField id=myField value=myValue checked=#IIF(something eq 'somethingelse', DE('Yes'), DE('No'))# / Are there better ways of doing this? ~| Create Web Applications With ColdFusion MX7 Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273495 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Just a tidbit for those who might not have use iif before
First better way: Don't use strings for booleans! cfinput type=radio name=myField id=myField value=myValue checked=#IIF(something eq 'somethingelse', 1, 0)# / Second better way: Don't write if True then True else False! cfinput type=radio name=myField id=myField value=myValue checked=#(something eq 'somethingelse')# / (parenthesis are unnecessary here, but I feel they make it more readable) Third better way: Don't use cfform! form:select id=myField options=myValue value=somethingelse/ (that's from my form custom tag library, not yet released) :) I'm assuming there is a noticeable difference in using IFF? Recently I've been using it quite heavily in forms now i.e. cfinput type=radio name=myField id=myField value=myValue checked=#IIF(something eq 'somethingelse', DE('Yes'), DE('No'))# / Are there better ways of doing this? ~| ColdFusion MX7 and Flex 2 Build sales marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273508 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Just a tidbit for those who might not have use iif before
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: 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 dollarFormat does not break) This is great instead of a cfif around the whole thing. Kinda cool =) Chris ~| ColdFusion MX7 and Flex 2 Build sales marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273436 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Just a tidbit for those who might not have use iif before
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'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 dollarFormat does not break) This is great instead of a cfif around the whole thing. Kinda cool =) Chris ~| Create Web Applications With ColdFusion MX7 Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273437 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Just a tidbit for those who might not have use iif before
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 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: 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 dollarFormat does not break) This is great instead of a cfif around the whole thing. Kinda cool =) Chris ~| Macromedia ColdFusion MX7 Upgrade to MX7 experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273438 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Just a tidbit for those who might not have use iif before
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 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'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 dollarFormat does not break) This is great instead of a cfif around the whole thing. Kinda cool =) Chris ~| Create Web Applications With ColdFusion MX7 Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273439 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Just a tidbit for those who might not have use iif before
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, there's a better way. There are exceptions, but I don't think this is one of them. -Justin Scott ~| Create Web Applications With ColdFusion MX7 Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273442 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Just a tidbit for those who might not have use iif before
I think I heard something about them going back on tour this year... On 3/22/07, Andy Matthews [EMAIL PROTECTED] wrote: 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'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 dollarFormat does not break) This is great instead of a cfif around the whole thing. Kinda cool =) Chris ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:273463 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4