Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ONE FOR THE EXPERTS - Appending lines with different for
Message
From
14/05/1998 16:38:16
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00098397
Message ID:
00099588
Views:
64
>You could open the INCOMING.SDF file with the low-level function (FOPEN) and walk through it line by line. Check the first character of the line and INSERT it into the correct table. It would look something like this:
>
[snip]
> Case Left(lcRecord,1) = 'A' && A means this record goes into table1
> Insert Into Table1 Values SubStr(lcRecord,2) && Ecludes the first char
> Case Left(lcRecord,1) = 'B' && B means this record goes into table2
> Insert Into Table2 Values SubStr(lcRecord,2)
> ... && Do this for each record type
> ...
> EndCase
>EndDo
>FClose(lnHandle)

This would surely be the way to go, if it could work, but it won't - Insert works on field-by-field basis, so all SubStr(lcRecord,2) would have to be chopped into substrings, one per field, with additional work on thir conversion to proper data types (dates, numbers etc). Could take some hours to write. Append ... SDF does this automatically, provided the table structure matches the coulmn widths in the SDF file.

I've run a little test on the compatibility of new numeric data types with the SDF format - well, it works for itself, i.e. I've managed to copy from it into a SDF file, and append back (even though I have Set Point to "," - an European comma, which has always been an obstacle in previous versions of Fox - nice feature, MSFT!)

>>
>>use table1
>>append from incoming.sdf type sdf for c1="A"
>>use table2
>>append from incoming.sdf type sdf for c1="B"

I've suggested this simply because it was simple :)

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform