Alpha Video Training
Results 1 to 3 of 3

Thread: export.field - date field problem

  1. #1
    Member
    Real Name
    Mike Vance
    Join Date
    Jun 2004
    Location
    Guernsey, Channel Islands
    Posts
    419

    Default export.field - date field problem

    The following xbasic code works perfectly except for the paydate field which is in English 22/05/09 format in all the table records.

    After the export the csv file shows it in the American version 05/22/09 which has to be loaded into Excel, cell format changed manually, then csv file re-saved.

    When I try to use format_data(tbl.paydate,"7/") I get an error message and I am not sure why that is.

    Can anyone help please? Mike


    dim tbl as P
    tbl = table.open("SagePay")
    filename = ui_get_file("Destination File", "EXCEL(*.XLS)", "SagePayFile.xls","N")
    if filename = "" then
    end
    end if
    response = ui_get_radio("Export Fieldnames To File? ",1,"Yes","No")
    if response = "Yes" then
    export_sagepay = .T.
    else
    export_sagepay = .F.
    end if

    export.file = filename
    export.type = 4
    export.sagepay = export_sagepay
    export.options = "T" 'strip trailing blanks
    export.field_sep = ","
    export.rec_sep = "<CR><LF>"
    export.fields = 8

    export.field1 = "acct_no"
    export.field2 = "not_used1"
    export.field3 = "not_used2"
    export.field4 = "Notes"
    export.field5 = "paydate"
    'export.field5 = format_data(tbl.paydate,"7/")
    export.field6 = "not_used3"
    export.field7 = "debit"
    export.field8 = "credit"
    tbl.export()
    tbl.close()

  2. #2
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,785

    Default Re: export.field - date field problem

    In the same way that paydate is quoted in this line

    Code:
    export.field5 = "paydate"
    your expression should also be quoted. Like

    Code:
    "format_data(paydate,\"7/\")"
    The double quotes in the expression need to be escaped with the back slashes
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

  3. #3
    Member
    Real Name
    Mike Vance
    Join Date
    Jun 2004
    Location
    Guernsey, Channel Islands
    Posts
    419

    Default Re: export.field - date field problem

    Thanks very much Tim. I see where I went wrong. I should have known better.

    Mike

Similar Threads

  1. Convert Numeric8 field to a Date format field
    By dchiass in forum Alpha Five Version 7
    Replies: 3
    Last Post: 09-07-2006, 11:55 PM
  2. Occasional Date Field Problem
    By J Bowers in forum Alpha Five Version 5
    Replies: 2
    Last Post: 10-22-2005, 09:34 AM
  3. Changing date field when set as calculated field
    By Cheryl Lemire in forum Alpha Five Version 5
    Replies: 2
    Last Post: 08-08-2004, 09:48 AM
  4. DATE FIELD PROBLEM
    By Rich Hartnett in forum Alpha Five Version 4
    Replies: 7
    Last Post: 01-16-2004, 09:38 AM
  5. Problem with Smart Field (Date/Calendar)
    By Randy Hyland in forum Alpha Five Version 5
    Replies: 5
    Last Post: 11-11-2003, 07:56 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
  •