Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does anyone remember
Message
From
14/07/1999 12:57:55
 
 
To
13/07/1999 18:28:14
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00240011
Message ID:
00241346
Views:
18
I'll go you one better!
* convert text file to memo field
* WARNING:  UNTESTED CODE!  THIS IS JUST OFF THE TOP OF MY HEAD!
* programmer, Todd Sherman, for Fred!
* 7/14/99
* This program is free to anyone and anywhere.  I'm not to blame if it doesn't 
* do what you think it should, claims to do, or doesn't claim to do!
* 
* Conventions:  UPPER case for wierd stuff, MixEd Case for Names of Things & 
*               such, lower case for every thing else!

* You might want to change the Variable and Table names so the program makes 
* sense!
*
* Assumes that you copied all relevant files to a single dir, and only those 
* files are in the dir.  If you can't do that, you fix the program!
* Also assumes that you want one record per file, if you want all the files in 
* one record, then you fix the program (remark out the append blank line?)
local Number_Of_Files, All_Files, Cur_File
Number_Of_Files = adir(All_Files, "MyDir\*.*"
if Number_Of_Files = 0 then
   wait window 'Either put the files in MyDir, or fix the program!'
   return
endif
create cursor Big_Text (File_Name C (254), File_Content M)
for Cur_File = 1 to Number_Of_Files
   append blank
   append memo File_Content from (All_Files(Cur_File, 1))
   replace File_Name with All_Files(Cur_File, 1))
next
* if you want to save the cursor forever, COPY TO BIG_TEXT
* cut and paste this into a .prg file, then you should be able to run it!
* Have a Great Day!
******
>Hey Todd
>
>Your solution seems like the most viable one so far. Can you give me an example of what the code you might use in the command window. I can probably fumble my way through it from there.
>
>Many Thanks,
>
>Fred Watt

Hi Fred!

So, you want to (for example) create a memo field with all 1000 records in it?

The easy way to do that is to append directly from the text file into the memo field. Just create the table with 1 field (your memo field) append a blank record, and then _append memo from mytextfile.txt_

Hope this helps

>What I am working with is many many straight text files that I have imported into a table fox reads the text file as thousands of records and that's okay. What I need to do is to take the text now a .dbf and make it one large record as oppose to many records. Hope that's helpful enough, like I said the last time I did any serious programming was in DOS/Windows versions of fox.
>
>Sincerely,
>
>Fred Watt
Todd
--Todd Sherman
-Wake Up! Smell the Coffee!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform