Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Appending fields from a table
Message
From
19/06/2002 17:34:49
 
 
To
19/06/2002 17:15:56
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00670283
Message ID:
00670327
Views:
33
This message has been marked as the solution to the initial question of the thread.
Ravi,

I see what you want now. APPEND FROM won't help you here (it could be called several times inside of a loop, but it would be very inefficient).

Is this something you will have to do regularly? If so, consider not doing it at all. You can pull this information together at any time with one SQL Select statement, joining on the common field.

Also, I don't know if having a field called 'number' is a good idea because it is a VFP reserved word.

Here is one way. Change lcTagName line to the correct index tag for the refDocsAddy table (it is used in the indexSeek call). This is off the top of my head, so test it on backup data.
local lcTagName
lcTagName = "refsDocsAddyTag"   && change this to the appropriate tag name
use refDocsAddy in 0
use refDocsWithAddress in 0
select refDocsWithAddress
scan
    if indexSeek(refDocsWithAddress.number, .t., 'refDocsAddy', lcTagName)
        replace specialty with refDocsAddy.specialty in refDocsWithAddress
        replace city with refDocsAddy.city in refDocsWithAddress
    endif
endscan
HTH,

steve


>>What do you mean by "for the first record only"? Are you expecting it to append several records? A not eof() loop won't help...because that function won't evaluate properly for the table you are appending from (at least I don't think it will).
>>
>Steve:
>
>I have two tables RefDocsAddy and RefDocsWithAddress.
>
>RefDocsAddy has the following fields: Number, Name, Speciality, City
>RefDoscWithAddress has the more fields in addtion to the fields in RefDocsAddy
>
>What I am trying to accomplish is, if there is a matching value in the Number fields of both tables, then I want RefDocsAddy.Speciality and RefDocsAddy.City to be inserted into RefDocsWithAddress.Speciality and RefDocsWithAddress.Location. Then move to the next record and if there is a match, do the same.
>
>Hope I am making sense. Thanks.
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform