|
Technical answers from the trenches |
|
Exporting Memos and BLOB's
| ||||
Posted: 10 December 2001 |
||||
  |
Applies to: Paradox 5.0 and later |
|||
  |
Audience: Intermediate |
|||
Question: By default, Paradox does not export memo or BLOB fields to delimited text files. Is there any way to do this?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:
|
|||
|
||||||||
|
Copyright © 2000-2004, techtricks.com; All Rights Reserved. Acknowledgements, Disclaimers, Terms and Conditions. |
||||||||
|
Article last updated on 01 June 2003
|
||
|
|
||
|
[- End -]
|