Re: Iif() and StructKeyExist()
On 2/20/03 1:17 PM, Aidan Whitehall [EMAIL PROTECTED] wrote: I've got an array of structures and am looping through them and writing several queries on the fly. However, I can't hit on just the right combination of quotation marks to stop it throwing an error. Does anyone know how to write it correctly, outputting either null or the value surrounded by apostrophes? A change in direction would be to consider if you could construct your queries with CFQUERYPARAM. Then you wouldn't need to worry about quoting or apostrophes. I'm not good off-the-cuff with cfqueryparam. I'm sure someone here can give a good example of a null check added to a cfqueryparam ... Any takers? #Iif(not StructKeyExists(values[i], proximity), DE(null), ' values[i][proximity] '))# Thanks! ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Iif() and StructKeyExist()
I don't think you can use IIF in this case as IIF has a habit of evaluating both results regardless of whether it resolves to true or false. Even if proximity doesn't exist, it will still evaluate values[i][proximity]. Yeah, that's how it's starting to look. Well, thanks for the confirmation. Guess it's a job for cfif. -- Aidan Whitehall [EMAIL PROTECTED] Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Iif() and StructKeyExist()
dont have time to test, but would it not need to something like this??? #Iif(not StructKeyExists(values[i], proximity), DE(null), DE(values[i][proximity])))# You would then need to check the value and decide whether quotes would work Could be wrong... my 2 secs worth -Original Message- From: Aidan Whitehall [mailto:[EMAIL PROTECTED]] Sent: 20 February 2003 21:18 To: CF-Talk Subject: Iif() and StructKeyExist() I've got an array of structures and am looping through them and writing several queries on the fly. However, I can't hit on just the right combination of quotation marks to stop it throwing an error. Does anyone know how to write it correctly, outputting either null or the value surrounded by apostrophes? #Iif(not StructKeyExists(values[i], proximity), DE(null), ' values[i][proximity] '))# Thanks! -- Aidan Whitehall [EMAIL PROTECTED] Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Iif() and StructKeyExist()
I don't think you can use IIF in this case as IIF has a habit of evaluating both results regardless of whether it resolves to true or false. Even if proximity doesn't exist, it will still evaluate values[i][proximity]. Cheers I've got an array of structures and am looping through them and writing several queries on the fly. However, I can't hit on just the right combination of quotation marks to stop it throwing an error. Does anyone know how to write it correctly, outputting either null or the value surrounded by apostrophes? #Iif(not StructKeyExists(values[i], proximity), DE(null), ' values[i][proximity] '))# Thanks! -- Aidan Whitehall [EMAIL PROTECTED] Macromedia ColdFusion Developer Fairbanks Environmental Ltd +44 (0)1695 51775 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4