Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Import from txt file
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00419269
Message ID:
00419297
Vues:
15
Hi Mike,
The following works for me: (tested in VFP6 SP3, NT4 SP5)
*!*  Structure off source file:
*!* Column  Description
*!* ------  -----------
*!*   1	    4 digit number (ie 9999)
*!*   2     4 digit number denoting the time (ie. 1235 which is 12.35)
*!*   3     8 digit number denoting the date (ie. 11092000)
*!*   4     one digit character which holds the flag (ie O = Out , I = In) 

*!* SourceFile.Txt
*!*  4100,0900,11082000,I
*!*  4101,1530,11082000,I
*!*  4102,1700,11082000,O
*!*  4103,2015,11082000,O

*!* Need to append a table with the following fields
*!*  code ,c,10
*!*  timein ,c,6
*!*  timeout ,c, 6
*!*  date ,c, 8

*!*  if the flag equals O the data should go to timein 
*!* if the flag equals I the data should go to timeout

#DEFINE __Flag    tOut
CLEAR ALL

CREATE CURSOR Test ;
	( cCode C(10), tIn C(6), cReceived C(8), tOut C(6) )

APPEND FROM c:\Temp\HB\SoureFile.Txt DELIMITED

UPDATE Test ;
	SET tOut = IIF( __Flag = "I", "", tIn ) ;
	  , tIn = IIF( ISDIGIT(__Flag), "", tIn )

LOCATE
BROWSE LAST NOWAIT
RETURN .T.
Regards
Houston.

>Hi to all
>I wonder how to acomplish the following:
>I have a text file (comma delimited) with the following format:
>1st colum is a 4 digit number (ie 9999)
>2nd column is a 4 digit number denoting the time (ie. 1235 which is 12.35)
>3rd column is a 8 digit number denoting the date (ie. 11092000)
>4th column is a one digit character which holds the flag (ie O = Out , I = In)
>Need to append a table with the following fields
>code ,c,10
>timein ,c,6
>timeout ,c, 6
>date ,c, 8
>if the flag equals O the data should go to timein
>if the flag equals I the data should go to timeout
>I have tried various techniques but no success.
>Any ideas?
>Thanking you in advance
>Regards
>Mike
censored.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform