Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Appending dilemma
Message
De
25/10/1999 14:50:36
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00281093
Message ID:
00281155
Vues:
13
Crap. Change all nFH references to aFH. Sorry about that. I'm also missing a closing parenthesis on the INSERT INTO command.

Also, you'll want to =FCLOSE(aFH(1)), 2, and 3 after the ENDDO.




>>Huh? I don't follow......
>I am not real familiar with some of the commands but in just executing there are errors:
>In lines 2-4 'variable not found'
>and the last line gives a syntax error.
>
>
>>>Ok, trying it but should the nFH's line 2-3 be changed to something declared?
>>>>OK, Tim....DIME aFH(3),aIsData(3),cData(3)
>>>>nFH(1)=FOPEN("a.txt")
>>>>nFH(2)=FOPEN("b.txt")
>>>>nFH(3)=FOPEN("c.txt")
>>>>STORE .T. TO aIsData
>>>>STORE "" TO cData
>>>>USE mydbf
>>>>DO WHILE aIsData(1) AND aIsData(2) AND aIsData(3)
>>>> FOR i = 1 TO 3
>>>> cData(i)=""
>>>> IF !FEOF(aFH(i))
>>>> cData(i)=FGETS(aFH(i))
>>>> ELSE
>>>> aIsData(i)=.F.
>>>> ENDIF
>>>> ENDFOR
>>>> INSERT INTO mydbf (a,b,c) VALUES (cData(1),cData(2),cData(3)
>
>>>>
>>>>How about this:
>>>>>>>ENDDO
>>>>
>>>>
>>>>>John, the lengths are 6,8,6 chars respectively. no releation exists between the three.
>>>>>
>>>>>
>>>>>>Are a.txt, b.txt, and c.txt of the same record length? Is there a 1-to-1-to-1 correlation between the 3?
>>>>>>
>>>>>>If so, you could always use FOPEN() to open all three and then loop until FEOF(). Use FGETS to get a line from each of the three into vars, APPEND BLANK (or INSERT INTO) for the table and then get the vars into the table.
>>>>>>
>>>>>>
>>>>>>>I ran out of ideas for accomplishing the following:
>>>>>>>I have an empty dbf with fields a,b,c and I have 3 txt files a.txt, b.txt,c.txt to be appended using sdf. I want a,b,c to be populated from top down with no blanks.Instead, by nature, new records keep getting appended leaving fields c & d blank to start.
>>>>>>>hmmmmm.
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform