Alpha Video Training
Results 1 to 11 of 11

Thread: Export a character field containing Line-Feed to a .CSV file

  1. #1
    Member
    Real Name
    Nick fardjam
    Join Date
    Jan 2012
    Location
    Los Angeles ,California USA
    Posts
    155

    Default Export a character field containing Line-Feed to a .CSV file

    Hello All,
    I am trying to export a table to a .CSV text file. There is a character field that contains Line-Feeds .This field is exported without line-feeds even though it is surrounded by double-quotes .
    Here is the Way I assign the field :

    C_field=""" + "Tracking No:"+ Crlf() + Var->Tracking_list + """

    "Var->Tracking_list" is a <Crlf> delimited list . What am I doing wrong?
    I appreciate any help or suggestion,I can't find a way to it.
    Thanks,
    Nick

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Export a character field containing Line-Feed to a .CSV file

    The line feed is the normal line termination character for a csv file. Probably won't be able to get around that unless you change it in the Alpha export specification.
    There can be only one.

  3. #3
    Member
    Real Name
    Nick fardjam
    Join Date
    Jan 2012
    Location
    Los Angeles ,California USA
    Posts
    155

    Default Re: Export a character field containing Line-Feed to a .CSV file

    Thanks Stan, I need to import the CSV file in to another application (sage 50 accounting) and the format must be terminated this way .
    Is there another way of creating this text file?
    Thanks,
    Nick

  4. #4
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,586

    Default Re: Export a character field containing Line-Feed to a .CSV file

    Can you Show us what Sage expects the file to eventually look like?
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  5. #5
    Member
    Real Name
    Nick fardjam
    Join Date
    Jan 2012
    Location
    Los Angeles ,California USA
    Posts
    155

    Default Re: Export a character field containing Line-Feed to a .CSV file

    This is the required format : "You must include a file header, specifying the fields (identifiers) you intend to import. Then each new record must start on a new line and each value must be separated from the next by a comma."

    When I open the exported Csv file with notepad I see that the
    Line-feeds are not exported but each record is otherwise correct so
    Alpha is not confused by the line-feeds, they are just replaced by a space.

  6. #6
    Member Bob Whitaker's Avatar
    Real Name
    Bob Whitaker
    Join Date
    Jun 2000
    Location
    Sutton-Coldfield, UK
    Posts
    694

    Default Re: Export a character field containing Line-Feed to a .CSV file

    In your export definition try using the line

    export.record_sep = "<CR><LF>"
    Bob Whitaker


  7. #7
    Member
    Real Name
    Nick fardjam
    Join Date
    Jan 2012
    Location
    Los Angeles ,California USA
    Posts
    155

    Default Re: Export a character field containing Line-Feed to a .CSV file

    These are the settings I already have:
    export.options = "LT"
    export.field_sep = ","
    export.record_sep = "<CR><LF>"

  8. #8
    Member
    Real Name
    Nick fardjam
    Join Date
    Jan 2012
    Location
    Los Angeles ,California USA
    Posts
    155

    Default Re: Export a character field containing Line-Feed to a .CSV file

    I included a N in options (export.options = "LTN") as it say in Alpha documentation to "preserve line breaks" ,With no effect .
    In the Alpha help documents the "N" in the options is supposed to preserve line breaks ,but apparently that is not the case .I wonder if that a bug.

  9. #9
    Member
    Real Name
    Allen Klimeck
    Join Date
    Apr 2000
    Location
    Colorado
    Posts
    535

    Default Re: Export a character field containing Line-Feed to a .CSV file

    The built it export can only export a single record at a time it appears that you are trying to create multiple records from a single record. You would need to create a temp table where each record is a single record and export that table or write the csv file with xbasic.

  10. #10
    Member
    Real Name
    Nick fardjam
    Join Date
    Jan 2012
    Location
    Los Angeles ,California USA
    Posts
    155

    Default Re: Export a character field containing Line-Feed to a .CSV file

    Thanks Allen, No I am just trying to export a Meno field .If you look at the Tbl.Export() method in the help documents it should be possible to export a Memo field with Line breaks preserved if you
    include a "N" in the options.

  11. #11
    Member Bob Whitaker's Avatar
    Real Name
    Bob Whitaker
    Join Date
    Jun 2000
    Location
    Sutton-Coldfield, UK
    Posts
    694

    Default Re: Export a character field containing Line-Feed to a .CSV file

    We have a number of routines for transferring data to various versions of Sage.
    PM me for more details.
    Bob
    Bob Whitaker


Similar Threads

  1. Removing Carriage Return or Line Feed in a Memo field
    By Ted Giles in forum Alpha Five Version 11 - Desktop Applications
    Replies: 25
    Last Post: 01-15-2015, 08:32 AM
  2. Soft Line Feed
    By G Gabriel in forum Alpha Five Version 11 - Desktop Applications
    Replies: 20
    Last Post: 01-24-2012, 11:14 AM
  3. write.line export to text file by date
    By Ed Merritt in forum Alpha Five Version 9 - Desktop Applications
    Replies: 3
    Last Post: 01-20-2009, 12:38 AM
  4. start "new line" in character field
    By qwest in forum Alpha Five Version 1
    Replies: 4
    Last Post: 11-19-2008, 10:03 AM
  5. line feed (LF) in a variable?
    By Daniel Weiss in forum Alpha Five Version 4
    Replies: 3
    Last Post: 12-21-2001, 03:26 PM

Bookmarks

Posting Permissions

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