Alpha Video Training
Results 1 to 5 of 5

Thread: Trailing Spaces from Export

  1. #1
    Member
    Real Name
    Thomas Holt
    Join Date
    Apr 2000
    Posts
    191

    Default Trailing Spaces from Export

    Hello All,

    We are having some difficulty with an export operation, the code for the operation is as below:

    a_tbl = table.open("tcs_expfile")
    query.order = ""
    query.filter = "TCS_SENT.T."
    query.options = "I"
    a_tbl.query_create()
    export.type = 0
    export.names = .F.
    export.file = "c:tcs_exporttcs_export.txt"
    export.options = "T"
    export.field_sep = ""
    export.record_sep = ""
    export.fields = 1
    export.field1 = "tcs_expfile->tcs"
    a_tbl.export()
    a_tbl.close()

    The company we are sending the final 'tcs_export.txt" file keep informing us that this is failing there validation check due to the fact of trailing spaces at the end of each record. This is confusing me as according to the manual export.options="T" removes trailing blanks from the field, and the record is made up only of the one field. The fields data varies in length, and we need to be able to send just the data with no trailing spaces, is this possible when exporting to a .txt file ??
    Any help on how to avoid these spaces is greatly appreciated as I have tried many variations on the same theme.

    Cheers
    Tom

  2. #2
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default RE: Trailing Spaces from Export

    Tom:

    I see you have no field or record separator, have your tried to see what result you would get with these added? Otherwise you may have to use the file.write method to get the result you want.

    Finian

  3. #3
    Member
    Real Name
    Thomas Holt
    Join Date
    Apr 2000
    Posts
    191

    Default RE: Trailing Spaces from Export

    Hello Finian,

    Thanks for the quick response. I have now added in the record and field seperators and the file has still been rejected. I am now attempting to use the file.write() or file.write_line() method suggested. I have looked at the manuals and am rather confused. Below is an attempted script to write to an output file.

    dim tbl as p
    tbl=table.open("tcs_expfile")
    file_pointer=file_create("c:tcs_exporttcs_export.txt",FILE_RW_EXCLUSIVE)

    tbl.fetch_first()
    while .not. tbl.fetch_eof()
    file_pointer.write_line(allrim(tbl.tcs))
    tbl.fetch_next()
    end while
    file_pointer.flush()
    file_pointer.close()
    END
    I have tried a few variations of this and continually receive error messages. Any help as to where I'm missing the point and why the script is incorrect as always greatly appreciated.

    Many Thanks
    Cheers
    Tom

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

    Default RE: Trailing Spaces from Export

    The error messages would be of some help in debugging your script.

    The statement which writes the line to your new file contains a typo. Should be alltrim not allrim.

    -- tom

  5. #5
    Member
    Real Name
    Thomas Holt
    Join Date
    Apr 2000
    Posts
    191

    Default RE: Trailing Spaces from Export

    Good point Tom, sorry about that.

    Below is the current script I have removed the alltrim command.

    tbl=table.open("tcs_expfile")
    file_pointer=file_open("c:tcs_exporttcs_export.txt",FILE_RW_EXCLUSIVE)

    tbl.fetch_first()
    while .not. tbl.fetch_eof()
    file_pointer.write_line(tbl.tcs)
    tbl.fetch_next()
    end while
    file_pointer.flush()
    file_pointer.close()
    END

    when this script is run I receive the error messsage :
    "file_pointer.write_line("tbl.tcs")
    file_pointer.write_line method not found"

Similar Threads

  1. RTF in reports and spaces
    By Larry Ternowski in forum Alpha Five Version 5
    Replies: 3
    Last Post: 05-16-2004, 08:34 AM
  2. Align Spaces
    By Julie Johnson in forum Alpha Five Version 5
    Replies: 2
    Last Post: 02-04-2003, 03:09 PM
  3. Opinion on spaces
    By russ Boehle in forum Alpha Five Version 4
    Replies: 17
    Last Post: 05-23-2002, 10:11 AM
  4. Esc Key spaces
    By wmock in forum Alpha Five Version 4
    Replies: 6
    Last Post: 04-27-2002, 11:41 AM
  5. trailing spaces- duplicate check calculated field
    By vasant panjabi in forum Alpha Five Version 4
    Replies: 6
    Last Post: 08-03-2001, 12:02 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
  •