Alpha Video Training
Results 1 to 6 of 6

Thread: Export data to CSV

  1. #1
    Member
    Real Name
    Carter Weslock
    Join Date
    Jun 2002
    Location
    Michigan
    Posts
    56

    Default Export data to CSV

    I need to export data to a comma seperated file w/ "'s around everything. What I'm finding is that any character elements from the table get the quotes but others line dates do not. Any suggestions?

    It's set up like:

    export.type = 0
    export.names = .F.
    export.file = export_filename
    export.options = "QLTS"
    export.field_sep = ","
    export.record_sep = ""
    export.fields = 27

    Is there an option I'm missing?

    Thanks in advance for the help.

  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 data to CSV

    That's the way Alpha does it. How about creating another table like your original but with the numeric fields changed to character. Append records from the original to the new table using some variation of the str() function to change all the numdric values to character. Then do the csv export from the new table.

  3. #3
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default RE: Export data to CSV

    Carter,

    Guess I'm curious.

    Since the comma will delimit fields, and the CRLF pair will delimit records, why do you need to put quotes around numeric or date values? It's my understanding that quotes are used are char type fields because the char type field may have a comma embedded within it. This would not be the case for numeric or date values.

    -- tom

  4. #4
    Member
    Real Name
    robert adler
    Join Date
    Apr 2000
    Location
    Boynton Beach, BL
    Posts
    591

    Default RE: Export data to CSV

    Carter:

    I think you have to identify the fields that are going to be exported. In your sample you need 27 fields.

    export.field1 = "fld1_name" and so forth

    after the last field name you will need
    tbl.export()

    I hope this helps.

    bob adler

  5. #5
    Member
    Real Name
    Carter Weslock
    Join Date
    Jun 2002
    Location
    Michigan
    Posts
    56

    Default RE: Export data to CSV

    A good question. The program that I'm exporting to will not read the data elements unless there in quotes. It's going to convert the data stream into values for a 3rd program. The reason for the quotes is the parcing routing with in the importing program. I've requested the programmer update his code but, that's a lot like pulling teeth.

    The original reason for not appending to a second table and then importing is that I felt that I should be able to do this without that extra overhead. This export can have up to 20,000 records in the table. The 27 fields I'm exporting is about 1/3 of the master table. Because I'm exporting to a flat file, I'm thinking that I can export the data, changing the seperator to say a pipe character then reopen the file and replace the pipes with ",". That would avoid the issue a correct comma in a data element being replaced. The new question is how to get Alpha to do a search and replace on a data string. Should be easy enough.

    Thanks for everyones input. I'll post results or further questions if I still need help.

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

    Default RE: Export data to CSV

    "The new question is how to get Alpha to do a search and replace on a data string" - see stritran_special()

Similar Threads

  1. Data Export Utility?
    By Kim Taulbee in forum Alpha Four Version 6 and Prior
    Replies: 5
    Last Post: 02-23-2004, 07:24 AM
  2. HELP - Need Consultant for Data Export
    By Jeff Brenamen in forum Alpha Five Version 5
    Replies: 8
    Last Post: 11-20-2003, 06:20 AM
  3. How do you export Memo File Data????
    By ronwills in forum Alpha Five Version 4
    Replies: 2
    Last Post: 06-11-2002, 01:34 PM
  4. need to export data to MS Acess
    By msjd in forum Alpha Five Version 4
    Replies: 11
    Last Post: 03-30-2002, 04:00 PM
  5. Peachtree Data Export
    By Steve Trodler in forum Alpha Five Version 4
    Replies: 9
    Last Post: 04-29-2000, 07:38 AM

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
  •