$doctitle = "Exporting Memos and BLOB's"; $authname = 'Lance Leonard'; $attrinfo = ""; $audience = "2"; $versions = "Applies to: Paradox 5.0 and later"; $postdate = "10 December 2001"; $pagearea = 2; $navlinks = 'Paradox:'; $metakeys = "corel, borland, paradox, paradox for windows, export, exporting memos, blobs, textstream, tcursor, removing CRLF "; $metadesc = "Shows one way to export memos containing CRLF's to delimited test files"; ?> include( $DOCUMENT_ROOT . "/lib/pageinit.php" ); ?>
Answer: Yes. Try manually exporting the table, as shown in the following code sample:
proc fixup( strInput String ) String
; --------------------------------------------------------------
; If strInput contains CRLF's, this replaces them with "\n"
; and returns the result; otherwise, returns the original value.
; --------------------------------------------------------------
var
astrLines Array[] String
strRetval String
siCounter smallInt
endVar
strRetval = strInput
if strRetval.search( "\n" ) > 0 then ; separate CRLF's
strRetval.breakApart( astr, chr( 13 ) + chr( 10 ) )
strRetval = ""
; reassemble the string using "\n" instead of CRLF's
for siCounter from 1 to astrLines.size()
if ( astrLines[ siCounter ] <> "" ) then
strRetval = strRetval + astrLines[ siCounter ]
if siCounter < astrLines.size() then ; add "\n"
strRetval = strRetval + "\\n"
endIf
endIf
endFor
endIf
return strRetval
endProc
method run(var eventInfo Event)
var
tc TCursor
ts TextStream
endVar
const
DATAFILE = ":priv:rtlerrors"
TEXTFILE = "c:\\errors.txt"
STDERROR = "If [>>] is enabled, choose it for more details."
endConst
enumRTLErrors( DATAFILE ) ; create the data table
if not tc.open( DATAFILE ) then
errorShow( "Can't Open Errors Table", STDERROR )
else
if not ts.open( TEXTFILE, "nw" ) then
errorShow( "Can't Open Output File", STDERROR )
else
scan tc :
message( "Writing ", tc.recNo(), " of ",
tc.nRecords(), "..." )
ts.writeLine( "\"", tc.(1), "\"|",
"\"", tc.(3), "\"|",
"\"", fixup( tc.(4) ), "\"" )
endScan
; Add additional error-checking for full sanity.
ts.commit()
ts.close()
tc.close()
beep()
message( "Done!" )
endIf
endIf
endMethod
While this example looks involved, a careful review shows it's rather straightforward. There are two main elements to pay attention to:
Note that the fixup procedure declares the strinput parameter as a string. If you call fixup() with the contents of a memo field, your formatted data will become unformatted, much the same way that string( tc.formattedfield ) also returns unformatted data. This may or may be a problem for you.
The breakapart() call in fixup() shows how to remove CRLF pairs from memo data. Note that you need to skip certain elements in the resulting array to completely replace CRLF's with "\n" characters.