Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append from text file into memo fields
Message
From
01/06/2004 16:02:31
John Baird
Coatesville, Pennsylvania, United States
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00908998
Message ID:
00909019
Views:
13
If you are using vfp 7 or 8, you can use:
lcLine = FileToSTring(([C:\Spillman\FoxData\]+lcTable+[.txt])
=ALINES(laLines, lcLine, .T., '|')



>Here is the code that I used in a similar prg. My file was delimited with pipes.
>
>
>		lnfile=Fopen([C:\Spillman\FoxData\]+lcTable+[.txt])
>		If lnfile < 0
>			Messagebox("Error opening file!")
>		Else
>
>			Do While Not Feof(lnfile)
>				lcLine = Fgets(lnfile,700)
>				lnOccur= Occurs('|',lcLine)
>
>				lnPipe1 = At('|', lcLine , 1)
>				lnPipe2 = At('|', lcLine , 2)
>				lnPipe3 = At('|', lcLine , 3)
>				lnPipe4 = At('|', lcLine , 4)
>				lnPipe5 = At('|', lcLine , 5)
>				lnPipe6 = At('|', lcLine , 6)
>				lnPipe7 = At('|', lcLine , 7)
>				lnPipe8 = At('|', lcLine , 8)
>				lnPipe9 = At('|', lcLine , 9)
>				lnPipe10 = At('|', lcLine , 10)
>				lnPipe11 = At('|', lcLine , 11)
>				lnPipe12 = At('|', lcLine , 12)
>				lnPipe13 = At('|', lcLine , 13)
>				lnPipe14 = At('|', lcLine , 14)
>				lnPipe15 = At('|', lcLine , 15)
>				lnPipe16 = At('|', lcLine , 16)
>				lnPipe17 = At('|', lcLine , 17)
>				lnPipe18 = At('|', lcLine , 18)
>				lnPipe19 = At('|', lcLine , 19)
>				lnPipe20 = At('|', lcLine , 20)
>				lnPipe21 = At('|', lcLine , 21)
>				lnPipe22 = At('|', lcLine , 22)
>				lnPipe23 = At('|', lcLine , 23)
>				lnPipe24 = At('|', lcLine , 24)
>				lnPipe25 = At('|', lcLine , 25)
>				lnPipe26 = At('|', lcLine , 26)
>				lnPipe27 = At('|', lcLine , 27)
>				lnPipe28 = At('|', lcLine , 28)
>				lnPipe29 = At('|', lcLine , 29)
>				lnPipe30 = At('|', lcLine , 30)
>				lnPipe31 = At('|', lcLine , 31)
>				lnPipe32 = At('|', lcLine , 32)
>				lnPipe33 = At('|', lcLine , 33)
>				lnPipe34 = At('|', lcLine , 34)
>				lnPipe35 = At('|', lcLine , 35)
>				lnPipe36 = At('|', lcLine , 36)
>				lnPipe37 = At('|', lcLine , 37)
>				lnPipe38 = At('|', lcLine , 38)
>				lnPipe39 = At('|', lcLine , 39)
>				lnPipe40 = At('|', lcLine , 40)
>				lnPipe41 = At('|', lcLine , 41)
>				lnPipe42 = At('|', lcLine , 42)
>				lnPipe43 = At('|', lcLine , 43)
>				lnPipe44 = At('|', lcLine , 44)
>				lnPipe45 = At('|', lcLine , 45)
>				lnPipe46 = At('|', lcLine , 46)
>				lnPipe47 = At('|', lcLine , 47)
>				lnPipe48 = At('|', lcLine , 48)
>				lnPipe49 = At('|', lcLine , 49)
>
>
>*******************************
>				lcF1 = Alltrim(Substr(lcLine,1,lnPipe1-1))
>				lcF2 = Alltrim(Substr(lcLine,lnPipe1+1,lnPipe2-lnPipe1-1))
>				lcF3 = Alltrim(Substr(lcLine,lnPipe2+1,lnPipe3-lnPipe2-1))
>				lcF4 = Alltrim(Substr(lcLine,lnPipe3+1,lnPipe4-lnPipe3-1))
>				lcF5 = Alltrim(Substr(lcLine,lnPipe4+1,lnPipe5-lnPipe4-1))
>				lcF6 = Alltrim(Substr(lcLine,lnPipe5+1,lnPipe6-lnPipe5-1))
>				lcF7 = Alltrim(Substr(lcLine,lnPipe6+1,lnPipe7-lnPipe6-1))
>				lcF8 = Alltrim(Substr(lcLine,lnPipe7+1,lnPipe8-lnPipe7-1))
>				lcF9 = Alltrim(Substr(lcLine,lnPipe8+1,lnPipe9-lnPipe8-1))
>				lcF10 = Alltrim(Substr(lcLine,lnPipe9+1,lnPipe10-lnPipe9-1))
>				lcF11 = Alltrim(Substr(lcLine,lnPipe10+1,lnPipe11-lnPipe10-1))
>				lcF12 = Alltrim(Substr(lcLine,lnPipe11+1,lnPipe12-lnPipe11-1))
>				lcF13 = Alltrim(Substr(lcLine,lnPipe12+1,lnPipe13-lnPipe12-1))
>				lcF14 = Alltrim(Substr(lcLine,lnPipe13+1,lnPipe14-lnPipe13-1))
>				lcF15 = Alltrim(Substr(lcLine,lnPipe14+1,lnPipe15-lnPipe14-1))
>				lcF16 = Alltrim(Substr(lcLine,lnPipe15+1,lnPipe16-lnPipe15-1))
>				lcF17 = Alltrim(Substr(lcLine,lnPipe16+1,lnPipe17-lnPipe16-1))
>				lcF18 = Alltrim(Substr(lcLine,lnPipe17+1,lnPipe18-lnPipe17-1))
>				lcF19 = Alltrim(Substr(lcLine,lnPipe18+1,lnPipe19-lnPipe18-1))
>				lcF20 = Alltrim(Substr(lcLine,lnPipe19+1,lnPipe20-lnPipe19-1))
>				lcF21 = Alltrim(Substr(lcLine,lnPipe20+1,lnPipe21-lnPipe20-1))
>				lcF22 = Alltrim(Substr(lcLine,lnPipe21+1,lnPipe22-lnPipe21-1))
>				lcF23 = Alltrim(Substr(lcLine,lnPipe22+1,lnPipe23-lnPipe22-1))
>				lcF24 = Alltrim(Substr(lcLine,lnPipe23+1,lnPipe24-lnPipe23-1))
>				lcF25 = Alltrim(Substr(lcLine,lnPipe24+1,lnPipe25-lnPipe24-1))
>				lcF26 = Alltrim(Substr(lcLine,lnPipe25+1,lnPipe26-lnPipe25-1))
>				lcF27 = Alltrim(Substr(lcLine,lnPipe26+1,lnPipe27-lnPipe26-1))
>				lcF28 = Alltrim(Substr(lcLine,lnPipe27+1,lnPipe28-lnPipe27-1))
>				lcF29 = Alltrim(Substr(lcLine,lnPipe28+1,lnPipe29-lnPipe28-1))
>				lcF30 = Alltrim(Substr(lcLine,lnPipe29+1,lnPipe30-lnPipe29-1))
>				lcF31 = Alltrim(Substr(lcLine,lnPipe30+1,lnPipe31-lnPipe30-1))
>				lcF32 = Alltrim(Substr(lcLine,lnPipe31+1,lnPipe32-lnPipe31-1))
>				lcF33 = Alltrim(Substr(lcLine,lnPipe32+1,lnPipe33-lnPipe32-1))
>				lcF34 = Alltrim(Substr(lcLine,lnPipe33+1,lnPipe34-lnPipe33-1))
>				lcF35 = Alltrim(Substr(lcLine,lnPipe34+1,lnPipe35-lnPipe34-1))
>				lcF36 = Alltrim(Substr(lcLine,lnPipe35+1,lnPipe36-lnPipe35-1))
>				lcF37 = Alltrim(Substr(lcLine,lnPipe36+1,lnPipe37-lnPipe36-1))
>				lcF38 = Alltrim(Substr(lcLine,lnPipe37+1,lnPipe38-lnPipe37-1))
>				lcF39 = Alltrim(Substr(lcLine,lnPipe38+1,lnPipe39-lnPipe38-1))
>				lcF40 = Alltrim(Substr(lcLine,lnPipe39+1,lnPipe40-lnPipe39-1))
>				lcF41 = Alltrim(Substr(lcLine,lnPipe40+1,lnPipe41-lnPipe40-1))
>				lcF42 = Alltrim(Substr(lcLine,lnPipe41+1,lnPipe42-lnPipe41-1))
>				lcF43 = Alltrim(Substr(lcLine,lnPipe42+1,lnPipe43-lnPipe42-1))
>				lcF44 = Alltrim(Substr(lcLine,lnPipe43+1,lnPipe44-lnPipe43-1))
>				lcF45 = Alltrim(Substr(lcLine,lnPipe44+1,lnPipe45-lnPipe44-1))
>				lcF46 = Alltrim(Substr(lcLine,lnPipe45+1,lnPipe46-lnPipe45-1))
>				lcF47 = Alltrim(Substr(lcLine,lnPipe46+1,lnPipe47-lnPipe46-1))
>				lcF48 = Alltrim(Substr(lcLine,lnPipe47+1,lnPipe48-lnPipe47-1))
>				lcF49 = Alltrim(Substr(lcLine,lnPipe48+1,lnPipe49-lnPipe48-1))
>
>				If lnOccur > 0
>					lcOccur=Alltrim(Str(lnOccur))
>					lcLastPipe= 'lnPipe'+lcOccur
>					lcLastPipe=&lcLastPipe
>					lcLast= Alltrim(Substr(lcLine,lcLastPipe+1))
>
>
>
>				Endif
>
>				Do Case
>				Case Upper(Alltrim(lcView))=='RVJMARREST'
>
>					lcF3=Ctot(Substr(lcF3,10,10)+' '+Substr(lcF3,1,8))
>					lcF6=Ctot(Substr(lcF6,10,10)+' '+Substr(lcF6,1,8))
>
>					If (Year(lcF3) < 1900 And Year(lcF3) > 0) Or (Year(lcF6) < 1900 And Year(lcF6) > 0)
>						Strtofile('Table: '+lcTable+Chr(13)+Chr(10)+'String: '+lcLine+Chr(13)+Chr(10),'c:\errors.txt',1)
>
>					Else
>						Insert Into RVJMARREST (ARSTNUM,SEQ,ARSTDAT,BOOKNUM,MODBY,MODWHEN,ARSTAGN,;
>							ARSTTYP,ARSTOFF,JUDAGE,ARSTLOC,ARSTARE,REFRENC,;
>							PRESENT,ARSTDSP,TRN) Values ;
>							(lcF1,lcF2,lcF3,lcF4,lcF5,lcF6,lcF7,lcF8,lcF9,lcF10,lcF11,lcF12,;
>							lcF13,lcF14,lcF15,lcLast)
>
>					Endif
>
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform