Re: empty array elements
hi thanks for all your posts i will try it without the list qualify and how you suggested, thanks again. its good to know that i am on the right tracks though!! richard ~| 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:299327 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: empty array elements
>Apologies, I completely mis-read your OP :o thats ok no problem i thought i was going crazy for a min :) thanks dominic ~| 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:299326 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: empty array elements
> > hi dominic thanks for this. sorry i am not understanding correctly, why > would i delete an array element when i need to keep them? just want to > understand what you mean Apologies, I completely mis-read your OP :o Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~| 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:299303 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: empty array elements
;) The array stuff is really very useful - I can't remember who had the problem that I just blogged about, and I can't think how that situation could unavoidably arise, but that fixed it in a jiffy. Back to the problem though. In CF8, ditching the listQualify does indeed show a double comma for the blank values. So if using CF8 you could do something like: var columnNameArray = new Array("#Replace(arrayToList(columnName), ',', '","', 'all')#"); Not very pretty but it should work. Basically ListQualify() still has the blank list item 'bug'. -- Blog it up: http://fusion.dominicwatson.co.uk ~| 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:299302 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: empty array elements
Thanks for the link to the post on hidden array methods though-- I have learned my new CF/Java item for the day. :) ~Brad -Original Message- From: Dominic Watson [mailto:[EMAIL PROTECTED] Sent: Monday, February 18, 2008 3:07 PM To: CF-Talk Subject: Re: empty array elements > > While helpful, I don't think your blog post has to do with Richard's > actual problem. He does not appear to be dealing with missing array > elements-- just empty ones. Furthermore, he does not wish to remove > them-- but to retain them. ;) yeh - I misread it. Oops. Dom ~| 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:299301 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: empty array elements
> > While helpful, I don't think your blog post has to do with Richard's > actual problem. He does not appear to be dealing with missing array > elements-- just empty ones. Furthermore, he does not wish to remove > them-- but to retain them. ;) yeh - I misread it. Oops. Dom -- Blog it up: http://fusion.dominicwatson.co.uk ~| 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:299300 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: empty array elements
If you remove the listQualify function, does the empty array show up in the JS code when rendered? William -- William E. Seiter Have you ever read a book that changed your life? Go to: www.winninginthemargins.com Enter passkey: goldengrove Web Developer / ColdFusion Programmer http://William.Seiter.com -Original Message- From: Richard White [mailto:[EMAIL PROTECTED] Sent: Monday, February 18, 2008 12:40 PM To: CF-Talk Subject: Re: empty array elements >What method are you using to cast your CF array over to a JS array? hi william i am using the following code: var columnNameArray = new Array(#listQualify(arrayToList(columnName), "'")#); except i am noticing the same problem in cf arrays, is this not usual? thanks ~| 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:299299 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: empty array elements
While helpful, I don't think your blog post has to do with Richard's actual problem. He does not appear to be dealing with missing array elements-- just empty ones. Furthermore, he does not wish to remove them-- but to retain them. ~Brad -Original Message- From: Dominic Watson [mailto:[EMAIL PROTECTED] Sent: Monday, February 18, 2008 2:58 PM To: CF-Talk Subject: Re: empty array elements I've just blogged about my solution to this problem. I'm not quite sure how it is arising in your case, but the post demonstrates the problem and fix: http://fusion.dominicwatson.co.uk/2008/02/undefined-array-elements.html Dominic ~| 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:299298 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: empty array elements
I've just blogged about my solution to this problem. I'm not quite sure how it is arising in your case, but the post demonstrates the problem and fix: http://fusion.dominicwatson.co.uk/2008/02/undefined-array-elements.html Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~| 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:299297 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: empty array elements
I think your list conversion is the problem. CF pre 8 ignores empty list elements. Have you considered cfwddx? ~Brad -Original Message- From: Richard White [mailto:[EMAIL PROTECTED] Sent: Monday, February 18, 2008 2:40 PM To: CF-Talk Subject: Re: empty array elements >What method are you using to cast your CF array over to a JS array? hi william i am using the following code: var columnNameArray = new Array(#listQualify(arrayToList(columnName), "'")#); except i am noticing the same problem in cf arrays, is this not usual? thanks ~| 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:299296 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: empty array elements
>What method are you using to cast your CF array over to a JS array? hi william i am using the following code: var columnNameArray = new Array(#listQualify(arrayToList(columnName), "'")#); except i am noticing the same problem in cf arrays, is this not usual? thanks ~| 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:299294 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: empty array elements
hi dominic thanks for this. sorry i am not understanding correctly, why would i delete an array element when i need to keep them? just want to understand what you mean thanks richard ~| 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:299293 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: empty array elements
> > hi dominic, thanks for this, this looks quite interesting although i want > to know if its possible to actually keep all blank elements Sure, I was thinking about this and it's quite simple really: aTemp = ArrayNew(1); aTemp[2] = ''; ArrayDeleteAt(aTemp, 2); myArray.RemoveAll(aTemp); Dominic ~| 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:299286 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: empty array elements
What method are you using to cast your CF array over to a JS array? William -- William E. Seiter Have you ever read a book that changed your life? Go to: www.winninginthemargins.com Enter passkey: goldengrove Web Developer / ColdFusion Programmer http://William.Seiter.com -Original Message- From: Richard White [mailto:[EMAIL PROTECTED] Sent: Monday, February 18, 2008 10:06 AM To: CF-Talk Subject: empty array elements hi, i have battling with this problem for months and never thought to ask the experts for their opinion :) i have some instances in my code where i query a database and store the values in cf array variables for some processing. however i have noticed that if you try to store an empty value into an array element, it doesn't create that array element at all. then when i translate those arrays over to javascript arrays it causes problems. for example i try to create an array but 1 element is empty arrayName[1] = "one" arrayName[2] = "" // empty string arrayName[3] = "three" arrayName[4] = "four" when this is converted over to JS. Then in js code i am assuming that there are 4 elements but of course there isnt so it produces an error. Plus they are not in the correct position in the array: arrayName[1] = "one" arrayName[2] = "three" arrayName[3] = "four" i have so far got around it by checking whether it is an empty string when i get it out of the database and if it is i set the value to a dash '-'. this gives me the following: arrayName[1] = "one" arrayName[2] = "-" arrayName[3] = "three" arrayName[4] = "four" then in js i can run some code that checks whether the value is a dash '-' and if it is then it needs to treat it as an empty string. surely there is a better way to do it than this. i would appreciate your opinions and feedback. thanks very much richard ~| 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:299284 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: empty array elements
hi dominic, thanks for this, this looks quite interesting although i want to know if its possible to actually keep all blank elements thanks again ~| 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:299280 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: empty array elements
Here's a little something to delete all blank array elements (both undefined and blank strings): aTemp = ArrayNew(1); aTemp[2] = ''; myArray.RemoveAll(aTemp); Here's an article on the underlying java methods of the array object which include the removeAll method: http://coldfused.blogspot.com/2007/01/extend-cf-native-objects-harnessing.html HTH Dominic -- Blog it up: http://fusion.dominicwatson.co.uk ~| 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:299272 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
empty array elements
hi, i have battling with this problem for months and never thought to ask the experts for their opinion :) i have some instances in my code where i query a database and store the values in cf array variables for some processing. however i have noticed that if you try to store an empty value into an array element, it doesn't create that array element at all. then when i translate those arrays over to javascript arrays it causes problems. for example i try to create an array but 1 element is empty arrayName[1] = "one" arrayName[2] = "" // empty string arrayName[3] = "three" arrayName[4] = "four" when this is converted over to JS. Then in js code i am assuming that there are 4 elements but of course there isnt so it produces an error. Plus they are not in the correct position in the array: arrayName[1] = "one" arrayName[2] = "three" arrayName[3] = "four" i have so far got around it by checking whether it is an empty string when i get it out of the database and if it is i set the value to a dash '-'. this gives me the following: arrayName[1] = "one" arrayName[2] = "-" arrayName[3] = "three" arrayName[4] = "four" then in js i can run some code that checks whether the value is a dash '-' and if it is then it needs to treat it as an empty string. surely there is a better way to do it than this. i would appreciate your opinions and feedback. thanks very much richard ~| 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:299270 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4