RE: One More List Question:
The code worked just fine for me. If you are having extra blanks, there is something wrong with the data or with some other line of code. To cover all bases, you can write a simple udf to create the list: function addToList(list,value){ value = trim(value); if(NOT Len(value)) value = -; return ListAppend(list,value,|); } ... emailList = addToList(emailList,fromArray); If you are not passing this list to HTML, I would use a structure to store the info instead of a list. This way all your problems are gone and your code becomes much more readable! Pascal -Original Message- From: Les Mizzell [mailto:[EMAIL PROTECTED] Sent: 07 December 2004 20:29 To: CF-Talk Subject: Re: One More List Question: cfset emailList = ListAppend(emailList,REReplace(fromArray,^$,- ),|) I've tried about every combination of REReplace I can thing of, including [[:blank:]], but the below will toss an error every single time. Steve || [EMAIL PROTECTED] Note multiple things wrong with this... a. space before Steve b. 2nd element is blank/missing c. space before email address. Trying to cover all stupid client tricks I can come up with... I've got trim statements applied before this stuff gets written to the database, plus I'm validating the email addresses, but just trying to get it divided up like the below when there's an empty position is giving me fits... cfset firstname = ListGetAt(emailLIST,1,|) cfset lastname = ListGetAt(emailLIST,2,|) cfset email = ListGetAt(emailLIST,3,|) -- Les Mizzell ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186612 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: One More List Question:
http://www.cflib.org/udf.cfm?ID=507 Pascal -Original Message- From: Les Mizzell [mailto:[EMAIL PROTECTED] Sent: 07 December 2004 18:01 To: CF-Talk Subject: One More List Question: Given the below: cfset firstname = ListGetAt(emailLIST,1,|) cfset lastname = ListGetAt(emailLIST,2,|) cfset email = ListGetAt(emailLIST,3,|) ...and the list it's reading from looks like, with a blank second element: Steve || [EMAIL PROTECTED] How do I *force* a value for lastname - even if it's just a placeholder like - or something... Thanks, -- Les Mizzell ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186481 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: One More List Question:
http://www.cflib.org/udf.cfm?ID=507 This looks like a start in the right direction. How would I apply it during the append process? cfset emailLIST = ListAPPEND(emailLIST, fromARRAY, |) Thanks, -- Les Mizzell ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186492 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: One More List Question:
It's meant to be applied on the finished list. If you create the list yourself, just replace empty values by something cfset emailList = ListAppend(emailList,REReplace(fromArray,^$,-),|) Pascal -Original Message- From: Les Mizzell [mailto:[EMAIL PROTECTED] Sent: 07 December 2004 18:41 To: CF-Talk Subject: Re: One More List Question: http://www.cflib.org/udf.cfm?ID=507 This looks like a start in the right direction. How would I apply it during the append process? cfset emailLIST = ListAPPEND(emailLIST, fromARRAY, |) ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186503 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: One More List Question:
cfset emailList = ListAppend(emailList,REReplace(fromArray,^$,-),|) I've tried about every combination of REReplace I can thing of, including [[:blank:]], but the below will toss an error every single time. Steve || [EMAIL PROTECTED] Note multiple things wrong with this... a. space before Steve b. 2nd element is blank/missing c. space before email address. Trying to cover all stupid client tricks I can come up with... I've got trim statements applied before this stuff gets written to the database, plus I'm validating the email addresses, but just trying to get it divided up like the below when there's an empty position is giving me fits... cfset firstname = ListGetAt(emailLIST,1,|) cfset lastname = ListGetAt(emailLIST,2,|) cfset email = ListGetAt(emailLIST,3,|) -- Les Mizzell ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186530 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: One More List Question:
Try: cfset emailList = Replace(emailList,||,| |,ALL) I've tried about every combination of REReplace I can thing of, including [[:blank:]], but the below will toss an error every single time. Steve || [EMAIL PROTECTED] Note multiple things wrong with this... a. space before Steve b. 2nd element is blank/missing c. space before email address. Trying to cover all stupid client tricks I can come up with... I've got trim statements applied before this stuff gets written to the database, plus I'm validating the email addresses, but just trying to get it divided up like the below when there's an empty position is giving me fits... cfset firstname = ListGetAt(emailLIST,1,|) cfset lastname = ListGetAt(emailLIST,2,|) cfset email = ListGetAt(emailLIST,3,|) -- Les Mizzell ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186562 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: One More List Question:
Try: cfset emailList = Replace(emailList,||,| |,ALL) cfset emailLIST = ListAppend(emailLIST,Replace(fromARRAY,||,|*|,ALL),|) If I do the above, it works if the *middle* element is missing - but still errors if the first or last element is missing. I think I'm going to take a different route. Since I know each list should have 3 elements if formatted correctly: cfif ListLen(emailLIST,|) NEQ 3 Forget doing anything... /cfif If the list isn't formatted exactly like they've said it would be, it won't process it ... Takes care of it once and for all! -- Les Mizzell ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:186572 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54