Re: Outputting a hash character in an IIF() function.
On Wednesday 09 Jan 2008, Ian Skinner wrote: I'm having trouble with this and the usual tricks don't seem to be working. #iif(bgFlag,DE(' style=background-color: #DDFFDD'),DE(''))# Why not just rewrite it so as not to use iif or de ? -- Tom Chiverton Helping to administratively architect scalable CEOs on: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296241 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Outputting a hash character in an IIF() function.
I'm having trouble with this and the usual tricks don't seem to be working. #iif(bgFlag,DE(' style=background-color: #DDFFDD'),DE(''))# This fails. I have tried escaping the internal hash character by doubling. I have tried to concatenate chr(35). Everything I do throws exceptions involving invalidly paired hash characters. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296238 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Outputting a hash character in an IIF() function.
Have you tried assigning it to a variable in a cfset and then displaying the variable. Alternately, convert to RGB: style=background-color:rgb(221 255 221)' -Original Message- From: Ian Skinner [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 09, 2008 9:34 AM To: CF-Talk Subject: Outputting a hash character in an IIF() function. I'm having trouble with this and the usual tricks don't seem to be working. #iif(bgFlag,DE(' style=background-color: #DDFFDD'),DE(''))# This fails. I have tried escaping the internal hash character by doubling. I have tried to concatenate chr(35). Everything I do throws exceptions involving invalidly paired hash characters. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296253 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Outputting a hash character in an IIF() function.
Tom Chiverton wrote: On Wednesday 09 Jan 2008, Ian Skinner wrote: I'm having trouble with this and the usual tricks don't seem to be working. #iif(bgFlag,DE(' style=background-color: #DDFFDD'),DE(''))# Why not just rewrite it so as not to use iif or de ? Generally because I prefer to KNOW why I have to replace one clear line of code with 5 lines of slightly less clear code that requires the using a few bits more memory to store a variable I will not use any place else. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296255 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Outputting a hash character in an IIF() function.
Dave wrote: Have you tried assigning it to a variable in a cfset and then displaying the variable. Alternately, convert to RGB: style=background-color:rgb(221 255 221)' Yes I can set and use a variable, but I was curious why I would have to do this. Why do I need to create five lines to set a variable and use a few bits more memory rather then use one clear function at the point where the decision needs to be made. The RGB solution is a good one. But I am still curious why one can not apparently output a hash mark in this manner. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296256 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Outputting a hash character in an IIF() function.
On Wednesday 09 Jan 2008, Ian Skinner wrote: Generally because I prefer to KNOW why I have to replace one clear line of code with 5 lines of slightly less clear code that requires the using a few bits more memory to store a variable I will not use any place else. if (foo){ bar=a }else{ bar=b } b seems clearer to me than nested iif and de. -- Tom Chiverton Helping to revolutionarily orchestrate B2B experiences on: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296257 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Outputting a hash character in an IIF() function.
The hash simply needs to be escaped as #iif(bgFlag,DE(' style=background-color: DDFFDD'),DE(''))# The hash needs to be escaped twice since you are delaying evaluation. The text: style=background-color: DDFFDD Is passed out of the de function as (including the quotes): style=background-color: ##DDFFDD That text is then evaluated by the iif to: style=background-color: #DDFFDD ~Brad -Original Message- From: Ian Skinner [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 09, 2008 10:14 AM To: CF-Talk Subject: Re: Outputting a hash character in an IIF() function. Dave wrote: Have you tried assigning it to a variable in a cfset and then displaying the variable. Alternately, convert to RGB: style=background-color:rgb(221 255 221)' Yes I can set and use a variable, but I was curious why I would have to do this. Why do I need to create five lines to set a variable and use a few bits more memory rather then use one clear function at the point where the decision needs to be made. The RGB solution is a good one. But I am still curious why one can not apparently output a hash mark in this manner. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296258 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Outputting a hash character in an IIF() function.
Actually, if I am going to use braces, I like them to align vertically for better readability: if (foo) { bar = a; } else { bar = b; } But enough of this. He didn't ask for our opinions in code readability, he asked how to escape a hash mark in an iif. (which I answered in my previous reply. ~Brad ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296259 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Outputting a hash character in an IIF() function.
Brad Wood wrote: The hash simply needs to be escaped as #iif(bgFlag,DE(' style=background-color: DDFFDD'),DE(''))# The hash needs to be escaped twice since you are delaying evaluation. The text: style=background-color: DDFFDD Is passed out of the de function as (including the quotes): style=background-color: ##DDFFDD That text is then evaluated by the iif to: style=background-color: #DDFFDD ~Brad Thanks, now I understand what is going on. I had tried three, but never took it to four. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296260 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Outputting a hash character in an IIF() function.
Tom Chiverton wrote: if (foo){ bar=a }else{ bar=b } b seems clearer to me than nested iif and de. This is completely personal preference and a very very small matter. But I generally find less to be clearer then more. -- cfscript if (foo) { bar='a'; } else { bar='b'; } /cfscript use_number #bar# - 7 lines VERSUS - use_number #iif(foo,DE('a'),DE('b'))# - 1 line. But each to his own. I still wanted to know WHY it was not working and now I do. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296262 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Outputting a hash character in an IIF() function.
cfscriptif (foo) {bar='a';} else {bar='b';}/cfscriptuse_number #bar# Now it's one line... who didn't see that coming? :-P ..:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296272 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4