Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding MessageRowHeaders

Status
Not open for further replies.
Mar 23, 2001
1
US
Altered the export code from the memo.exe export.fsl button to accomadate everything I need except I also want it to put the rowheaders for all fields in a table on the first line of ouput. I apologize this will be the only thing I will ever ask regarding ObjectPal. I am not familar with Paradox or ObjectPal.

Here is the code as stands:

method pushButton(var eventInfo Event)
var
b filebrowserinfo
thefile,delimiter,textfile,path string
t,t1 textstream
counter,counter1 smallint
temp anytype
m memo
lines array[] string
tc tcursor
endvar
ignoreCaseInStringCompares(yes)
delimiter="$"
;delimiter.view("Please enter the record delimiter")
;if delimiter="" then
;msginfo("Oops","You must enter a delimiter")
;return
;endif
b.allowabletypes=fbTable
b.selectedtype=b.allowabletypes
message("Select File to export")
if not filebrowser(thefile,b) then
return
endif
textfile="input.txt"
;textfile.view("Enter text file to create")
;if textfile="" then
;return
;endif
if not t.open(textfile,"nw") then
errorshow()
return
endif
path=getaliaspath(b.alias)+b.path
if path.substr(path.size())<>&quot;\\&quot; then
path=path+&quot;\\&quot;
endif
tc.open(path+thefile)
scan tc:
message(&quot;Exporting record &quot;+string(tc.recno()))
for counter from 1 to tc.nfields()
if tc.fieldType(counter)<>&quot;Graphic&quot; and tc.fieldType(counter)<>&quot;Oleobj&quot; and tc.fieldType(counter)<>&quot;Binaryblob&quot; then
tc.fieldvalue(counter,temp)
if tc.fieldtype(counter)<>&quot;Memo&quot; and tc.fieldType(counter)<>&quot;Fmtmemo&quot; then
t.writestring(temp)
else
m=temp
;If the size is less that 32K, it can be treated as a string.
if m.size()<32768 then
t.writestring(temp)
else
m.writetofile(&quot;:priv:temp&quot;)
t1.open(&quot;:priv:temp&quot;,&quot;r&quot;)
t1.readline(lines)
for counter1 from 1 to lines.size()
t.writestring(lines[counter])
if counter1<lines.size() then
t.writeline(&quot;&quot;)
endif
endfor
t1.close()
endif
endif
if counter<tc.nfields() then
t.writestring(&quot;|&quot;)
endif
endif
endfor
;t.writeline(&quot;&quot;)
;t.writeline(delimiter)
endscan
t.close()
tc.close()
message(&quot;Done&quot;)
endmethod

how would u change to output rowheaders or field names to first line of output separated by | like the rest and $ to indicate end.
 
Just before scan tc: try something like this (trash is of string type):

;start of additional code
trash = &quot;&quot;
lines.empty()
tc.enumFieldNames(lines)
for counter from 1 to lines.size()
trash = trash + lines[counter] + delimeter
endFor
;remove unwanted delimiter at end of line
trash = trash.subStr(1, trash.size() - delimeter.size())
t.writeline(trash)
;end of additional code

Hope this helps
Padraig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top