Carriage Return Problem

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Carriage Return Problem

    Hello,

    I have written some code which extracts data from a MySQL database and stores
    it in a CSV file using CFFILE.

    However, the database includes data inserted from an HTML textarea form
    element which is stored in a MySQL text field. The textarea data includes
    carriage returns which, when written to a CSV file, force a new line which
    makes the data messy.

    Is there a way of removing the carriage returns?

    Many thanks,

    Simon

    smnbin Guest

  2. Similar Questions and Discussions

    1. Carriage Return
      Please help me how I can enter text with carriage returns into my database. I have a Textbox with TextMode="MultiLine" Now, if inter a text...
    2. lingo carriage return
      Hi, Is their a lingo command that can insert a carriage return at the end of a line in a text field. Thanks, Ben
    3. FTP doesn't add Carriage Return from VMS to NT?
      When I try to use NET::FTP to transfer text files from VMS to NT (GET command using ASCII mode,) FTP will add the Linefeed, but not the required...
    4. return Carriage access 97
      I have a zone list, in this i want to put a field with 250 Char, But in the form a can see only the width of the zone list, so my question is how...
    5. Carriage return in .ini files
      Hi, I am using the FileIO xtra within my Director App to try and create an ini file that is being picked up by another application. However,...
  3. #2

    Default Re: Carriage Return Problem

    Use the Replace( ) function to get rid of your CR characters. Then place a CR at the end of each line before you write it as a CSV file.

    <CFSET myText = Replace(myText, Chr(13), "", "ALL")>
    jdeline Guest

  4. #3

    Default Re: Carriage Return Problem

    jdeline,

    Thank you for your response. However, I tried the following code, but a new
    line is still being forced in the CSV file.

    <cfset GetEndOfProgrammeEvaluationForms.c8 =
    Replace(GetEndOfProgrammeEvaluationForms.c8,Chr(13 ),"","ALL")>

    Any further ideas would be very much appreciated.

    Simon

    smnbin Guest

  5. #4

    Default Re: Carriage Return Problem

    jdeline,

    I tried the following, but it didn't work. I don't think my regular expression
    is correct.

    <cfset GetEndOfProgrammeEvaluationForms.c8 =
    REReplace(GetEndOfProgrammeEvaluationForms.c8,"Chr (10)|Chr(13)","All")>

    Any ideas?

    Many thanks,

    Simon

    smnbin Guest

  6. #5

    Default Re: Carriage Return Problem

    I recently had to deal with a similar situation. The differences are:
    1. My file is pipe delimited.
    2. My source data comes from a vendor application, not an html form.

    The following code worked for me.

    <cffile action="write" nameconflict="overwrite"
    addnewline="no" output=""
    file="d:\dw\dwweb\work\#CaseFileName#">

    <cfoutput query="casedata">
    <cffile action="append"
    file="d:\dw\dwweb\work\#CaseFileName#"
    output="#caseid#|strip a bunch of fields|#theatre_mcase#|#Replace(pre_op_diag,
    chr(10), ' ', 'all')##chr(13)#">
    </cfoutput>


    Dan Bracuk Guest

  7. #6

    Default Re: Carriage Return Problem

    You would use:
    <cfset GetEndOfProgrammeEvaluationForms.c8 = REReplace (GetEndOfProgrammeEvaluationForms.c8, "", "", "All")>
    MikerRoo Guest

  8. #7

    Default Re: Carriage Return Problem

    MikerRoo - that has fixed the problem.

    Thank you very much for your help.

    smnbin
    smnbin Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139