Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Appending fields from a table
Message
De
20/06/2002 02:13:59
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
19/06/2002 17:34:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00670283
Message ID:
00670474
Vues:
32
Hi Steve

That should work, except I'd use one replace command instead of two.
replace specialty with refDocsAddy.specialty,;
location with refDocsAddy.city in refDocsWithAddress
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform