;breakApart splits a string into an array of substrings
;each substring is written to an element of an array.
;You can specify one or more delimiting characters in separators.
;If you omit separators, substrings are delimited by a space.
;Delimiting characters are not included in tokenArray.
proc fixup( strInput String ) String ;This syntax sets the procedure up to take a passed value "strinput" from another method.
; --------------------------------------------------------------
; 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( astrLines, chr( 13 ) + chr( 10 ) ) ; This one step creates an array of all the "lines" in the memo field.
strRetval = "" ;This line resets the string after the array is created.
; reassemble the string using "\n" instead of CRLF's
for siCounter from 1 to astrLines.size(); This For loop puts the string back together without the CRLF's.
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 = "riv:rtlerrors" ;Put your table and path name here
TEXTFILE = "c:\\errors.txt" ;Put the output file name you want here
STDERROR = "If [>>] is enabled, choose it for more details." ;Just a helpful error message
endConst
{enumRTLErrors( DATAFILE ) ; create the data table not needed as your table already exists}
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), "\"|",;I believe the pipe translates to a tab otherwise it is the delimiter and not tab in your file.
"\"", tc.(3), "\"|",
"\"", fixup( tc.(4) ), "\"" ) ;tc.(4) is the memo field which is the fourth field in this table. You can reference it by name.
endScan
; Add additional error-checking for full sanity.
ts.commit()
ts.close()
tc.close()
beep()
message( "Done!" )
endIf
endIf
endMethod
Edit/Delete Message