X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Export Paradox Memo Fields to delimited text    
post Sep 10 2003, 04:18 PM

Posts: 435
Joined: 20-July 00
From: Chicago 'burbs

I got this from a database newsgroup. It works pretty well. You just have to remove a slash from the last field of each record. You get a Paradox error if you try to run it with only one slash as the record delimiter. Create a form with a button and add this code to its PushButton method.
method pushButton(var eventInfo Event)
   t,t1              TextStream
   counter,counter1  Number
   temp              AnyType
   m                 Memo
   lines             Array[] String
   tc                TCursor

t.open("yourfile.txt","nw")    ;Open the text file to export to.
tc.open("yourfile.DB")        ;Open the table to export from.
scan tc:                     ;Loop through all records.
   message("Exporting record " + string(tc.recno()))
   for counter from 1 to tc.nfields() ;Loop through all fields.
      if tc.fieldType(counter) <> "GRAPHIC" and ;Types to skip.
      tc.fieldType(counter) <> "OLEOBJ" and
;The next line is not required for versions 1.0 & 4.5
      tc.fieldType(counter) <> "BYTES" and
      tc.fieldType(counter) <> "BINARYBLOB" then
      if tc.fieldType(counter) <> "MEMO" and
         tc.fieldType(counter) <> "FMTMEMO" then
         t.writeString(temp)  ;Add content to text.
         m = temp
         if m.size() < 32768 then;Test memo field size.
            t.writeString(temp)  ;Add to text file.
           ;Write content to temporary file.
           ;Loop through each line of temp file.
            for counter1 from 1 to lines.size()
           ;Write each line to export text file.
            if counter1 < lines.size() then

      if counter < tc.nfields() then
         t.writeString("^")      ;Append a field separator.
   t.writeLine("\\")             ;Append a record delimiter
endScan                          ;and a new line.
Go to the top of the page
post Jan 22 2019, 05:58 PM

Posts: 9
Joined: 1-June 18

This worked as designed, but there is a problem.

When exporting memo fields that have CR and LF this causes a problem in the output file.

If you were to import this file to say MS Access or any other tool, you will then see the issue as the import is expecting one line per record and this
creates multiple lines for those memo fields that have actual CR LF in them.

It would be easy to fix had I been able to find some example of a string replace but it isn't easy to find in any documentation.

Thanks for the code as it did help get these out of my database.

Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    20th October 2019 - 09:31 PM