Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Appending dilemma
Message
From
25/10/1999 14:37:11
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00281093
Message ID:
00281143
Views:
14
Huh? I don't follow......

>Ok, trying it but should the nFH's line 2-3 be changed to something declared?
>>OK, Tim....
>>
>>How about this:
>>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)
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform