Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / September 2007



Tip: Looking for answers? Try searching our database.

carrage return issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KeithLaw999 - 15 Sep 2007 07:43 GMT
hi i have a array which is set from a csv file, and then inserted into a table.

the problem i am having is the surname which is the first array is entering a
carrage return before the text.

how can i remove this carrage return?

<!--- expected data fields ; Firstname, Surname, Phone, Group, ID --->
<cfset columncount = 7>
<cffile action="read" file="#currentdir#/#GetUser.CsvMatch#.csv"
variable="datafile">
<cfset counter = 1>
<cfloop index="datarec" list="#datafile#" delimiters="#chr(13)#">
<cfif counter gt 1>

<!---use ListToArray function with comma delimiter for each data record--->
<cfset dataArray = ListToArray(datarec,chr(44))>
<cfif ArrayLen(dataArray) eq columncount >

<cfquery name="INSERT" datasource="#application.ds#">
insert into player_table
(PlayerSurname, PlayerFirstName, PlayerPhone, Team, Class, App_ID, ClubID)
values

('#dataArray[1]#','#dataArray[2]#','#dataArray[3]#','#dataArray[4]#','#dataArray
[5]#','#dataArray[6]#',#getuser.clubID#)
</cfquery>
Dan Bracuk - 15 Sep 2007 11:10 GMT
Try it without an array.  Loop through your datarec list instead.  If you still
get the carraige return, use the replace function to get rid of it.  You've
shown in your posted code that you know how to do that.
KeithLaw999 - 16 Sep 2007 10:26 GMT
ok i need the array as i use it later in my code, so i tried this

'#replace(dataArray[1], '#chr(13)#', '', 'all')#'

but the carrage return stil appears before the text, any ideas how i can
replace this?
GArlington - 18 Sep 2007 10:24 GMT
> ok i need the array as i use it later in my code, so i tried this
>
>  '#replace(dataArray[1], '#chr(13)#', '', 'all')#'
>
>  but the carrage return stil appears before the text, any ideas how i can
> replace this?

Replace(dataArray[1], chr(13), "", "ALL");
Replace(dataArray[1], chr(10), "", "ALL");
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.