Within the loop you want to use the variable "i" (your "index")... That will be
the variables that holds one phone number at a time.
Also, I think you want to use try delimiters="#chr(10)##chr(13)#,"
Lastly, I can't tell if you really put the file upload with that form right
before the loop (or if you left out lots of code to keep your email simple),
but it doesn't look quite right. A simple way to start would be to manually
put the phone number file on the web server (in the same dir as the cfm page?)
and just read it in using cffile. If nothing else that should make it easier to
debug.
Thanks
Mark
-----Original Message-----
From: cfcom [mailto:[email protected]]
Sent: Wednesday, May 20, 2009 7:15 AM
To: cf-talk
Subject: RE: phone formating string and removing hidden characters
I set up a form to identify the character, but the square doesn't paste.
When I opened the orig file of the phone numbers in word it did list the
numbers on single lines so it may be a newline character.
My Loop must be wrong, it's only passing one value, any suggestions would be
most appreciated.
<form action="phone_action2.cfm"
enctype="multipart/form-data"
method="post" >
<p>Enter the complete path and filename of the file to upload:
<input type="file" name="FiletoUpload" size="45">
</p>
<input type="submit" value="Upload">
</form>
<cfoutput>
<cfloop list="#FiletoUpload#"
index="i"
delimiters="chr(10) chr(13) ,">
<cfset form.phone = "#FiletoUpload#">
<cfset cleanPhone = ReReplace(form.phone, "[^0-9]", "", "ALL")>
<cfoutput>#cleanPhone#</cfoutput>,<br /> </cfloop> </cfoutput>
<!--- if the character string is not empty, output its ASCII value ---> <cfif
IsDefined("FORM.charVals")>
<cfif FORM.charVals is not "">
<cfoutput>#Left(FORM.charVals,1)# =
#Asc(FORM.charVals)#</cfoutput>
<cfelse>
<!--- if it is empty, output an error message --->
<h4>Enter a character</h4>
</cfif>
</cfif>
<form action = "asc.cfm" method=post>
<p>Enter a character to see its ASCII value <br><input type = "Text" name =
"CharVals" size = "1" maxlength = "1"> <p><input type = "Submit" name = "">
<input type = "RESET"> </form>
-----Original Message-----
From: Charlie Griefer [mailto:[email protected]]
Sent: 2009-05-19 14:13
To: cf-talk
Subject: Re: phone formating string and removing hidden characters
just read it in doing a cffile and then do a cfloop over the content
using the newline as the delimiter (as Mark suggested). no need for
importing into a database or having to count 'x' number of characters.
you've already got the data delimited.
just loop over it and use the regex you posted earlier to remove any
non-numeric characters from each list element.
On Tue, May 19, 2009 at 11:09 AM, cfcom <[email protected]> wrote:
>
> Mark,
>
> I think it's a newline character
> I'm thinking I have to import the list into the database. Then query it
> With the cfloop. My question is how to I set the loop to do a 10 count
> sequence?
>
> Thanks
> Steve
>
>
> -----Original Message-----
> From: Gaulin, Mark [mailto:[email protected]]
> Sent: 2009-05-19 13:53
> To: cf-talk
> Subject: RE: phone formating string and removing hidden characters
>
>
> That screenshot looks like a newline character (or is it a linefeed?) as
> shown by an editor that was expecting a more Windows-ly standard line
> ending. Other editors (like EditPad) would probably show each phone
> number on its own line.
>
> Anyway, you can use cf's "asc()" method to find the actual value of the
> Nth character (the one that shows up as a box) and then you'll know what
> delimiter to use with the list functions. (I bet the character is 10 or
> 13, so you could try to set a delimiter of chr(10) or chr(13) and see
> what happens.)
>
> Once you know the delimited you can use a list function like <cfloop
> list=".." delimiter=".."> or ListToArray(list, delimiter) to convert
> your file content to individual lines. (You have lots of options... The
> key is figuring our what delimiter to use.)
>
> Thanks
> Mark
>
> -----Original Message-----
> From: cfcom [mailto:[email protected]]
> Sent: Tuesday, May 19, 2009 1:23 PM
> To: cf-talk
> Subject: phone formating string and removing hidden characters
>
>
> Hi,
>
> I have a text file of 100,000 plus phone numbers that I need to change
> formatting and export to a clean list. There is an unusual hidden
> character that doesn't appear when pasting. Here is a screen shot
> http://www.aceligent.com/post/hidden.html
>
> The list is compiled in this manner, 'X' is supplemented for where the
> hidden character is:
> 212,2000876x212,2002686x212,2005799x212,2007697x212,2010062x212,2010087x
> 212,
> 2010112x212,2010192x212,2010237x212,2010306x212,2010326x212,2010710x212,
> 2010
> 714x212,2010740x212,2010754x212,2010800x212,2010978x212,2011063x212,2011
> 065x
>
> I need to process the list as a batch. How would I adapt this to clean
> and count a 10 number sequence; add a coma; and repeat on new line? Then
> export as a text file.
>
> <cfset form.phone = "#form.phoneinput#"> <cfset cleanPhone =
> ReReplace(form.phone, "[^0-9]", "", "ALL")>
> <cfoutput>#cleanPhone#</cfoutput>
>
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322658
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4