Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append from text file delimited
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00793848
Message ID:
00793856
Vues:
30
Zaheer,
I use something like this:


lcFileContent=FILETOSTR(THIS.lcFileName)
NumBaiRecords=ALINES(la1,lcFileContent) && number of records in BAI file
FOR I=1 TO NumBaiRecords
lcCurrentline=la1[m.I]

var1=substr(lcCurrentline,1,10)
.....

insert into .....
endfor


hope this helps

Peter



>Hi All
>For data manipulation I have to import fixed width text files to VFP free table. It works ok when the each row width in the text file is less than 255 (CH). I use an empty table with single field 254 CH and then I use APPEND FROM textfile DELIMITED and then I use SUBSTR() to get the required fields to append another table. The example of prg file is as follows.
>

>LOCAL lcdesc,lcitemno,lnqty,lnprice
>IF ...
>create table junkpos.dbf(allfields c(254))
>ENDIF
>SELECT 1
>USE junkpos
>SELECT 2
>USE pos
>SELECT 1
>append from pos.txt delimited
>go top
>do while .not. eof()
> lcdesc=SUBSTR(allfields,1,50)
> lcitemno=SUBSTR(allfields,60,8)
> .......
> SELECT 2
> APPEND BLANK
> replace itemno WITH lcitem, itemdesc WITH lcitemdesc
> SELECT 1
> skip
> loop
>ENDDO
>

>When the row width in the text file is more than 254 Ch then I can not get complete line of the text due to field width 254 CH. I want to save each text file line in a single record with more than 254 Ch.
>Is there any help?
>Regards,
>Zaheer
Peter Cortiel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform