Just did a search keyword on "Export Memo Field" with options, Any word, Thread Body, any date. It found over 20 references. See thread 184-28876 titles "Memo Field to Text File.
David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
Actually, Dave, I was waiting for you to write the FAQ. In times past when this came up, I remember (accurately, I hope) that you posted some additional methods that handled memos longer than 254 characters.
I think you are eminently qualified to FAQ this topic.
Javierp,
As you will soon find out, there is no command that will export an entire memo field along with other fields into a delimited file. The answer to your question on how to do it lies in what you have not told us , "What do you want to do with the file?"
There are 3 ways to export a memo field, 2 of them required programming.
1. As Robert stated, pick a set length and export a section of the field.
2. Export the memo field a seperate text file, one text file for each record.
3. The entire memo field needs to be part of the exported file.
Sample code for the options above.
1. See Roberts Code above.
2. You will need a unique for each memo file. For this example I'll ASSUME you have a field ID that is a unique number not duplicated in the table.
[tt]
use xxx.dbf order ID alias MyTable
scan all
Copy memo MyTable.MemoField to (alltrim(MyTable.ID)+".TXT"
endscan
copy fields xxx,yyy,zzz to file MyTable.cdf delimited
[/tt]
3. For this example I am going to ASSUME your table structure that is all type "Character" fields and the MEMO field is the Last field.
[tt]
set memowidth to 100
dimension laArray(1)
use xxx.dbf order ID alias MyTable
lnFields = fcount()-1
lnFileNo = fcreate("MyTable.cdf" , 0)
scan all
lcString = alltrim(field(1))
for lnField = 2 to lnFields
lcString = lcString + ',"'+alltrim(field(lnField)+'"'
endfor
lnLines = alines(laArray , MyTable.MemoField)
for lnLine = 1 to lnLines
=fputs(lnFileNo, lcString+',"'+alltrim(laArray[lnLine])+'"')
endfor
endscan
=fclose(lnFileNo)
close all
[/tt]
P.S. The coffee pot just stopped brewing so now I'll now have my first cup of the day. I sure hope the code is correct.
David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
After having my first cup of coffee I noticed an error in my code.
change any reference to alltrim(field(x)) to alltrim(eval(field(x)))
or better yet, I wonder if alltrim(transform(eval(field(1)))) would work for all field types. Hmmmm Food for thought.
David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
When I was having problems with this issue, (Dave, Robert, and several others responded for which I am very grateful.), I used Robert's code for the memo fields 254 or less in length. For files with memo fields over that length, I imported them into a MSSql7 table then exported from SQL to a delimited text file.
Gladys
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.