Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Compare
Message
De
08/11/2005 06:09:34
 
 
À
08/11/2005 05:53:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 8
Database:
Visual FoxPro
Divers
Thread ID:
01066331
Message ID:
01066350
Vues:
12
>hi,
>how are you.

Quise shokran.

>i have 2 tables as you see TTY TABLE have tel,type with full data,
>another SSS TABLE have just tel,field typ is empty i need to seek if tel=tel replace typ with type,

So I assume that for each rec in TTY you're looking for a matching rec in SSS? Why not set up the permanent relationship between the 2 tables, or use the SET RELATION command to set it up tempoararily? SO:

* assuming reln. between the tables based on Key TEL, Tag TEL
Select TTY
Scan
m.tel = tel
m.typ = typ
If INDEXSEEK( m.Tel, .T., "SSS", "TEL")
Select SSS
Replace Typ with m.Typ in SSS

* You can't do the ELSE replace with space(10) because you don't know what record you're at if the Locate
* or Indexseek fails. In fact, I think you'd be at EOF() - especially if use locate

EndIf
EndScan

Masalaam

>
>INDEXSEEK(), i think new thing for me.
>
>if you have a time to write sample code it will be fantastic. if not it will be fantastic.
>have a nice time
>
>m.qasem
>
>>>hi,
>>>thank you for reply,
>>>
>>>this code make infinit loop,
>>
>>M
>>
>>You don't need the Scan loop. You're just trying to locate a particular record in the table. If, OTOH, you're going through one table and trying to find matching recs in another, then you need to select the other table within the loop, or better still, have matching keys (as a relationship between them) and do an
>>INDEXSEEK()
>>
>>Where does the table sss come into this otherwise?
>>
>>>
>>>
>>>
>>>>>hi all,
>>>>>
>>>>>any help.
>>>>>i try to compare between 2 tables as under , but no result
>>>>>
>>>>>
>>>>USE tty in 0
>>>>    m.tel=tel
>>>>    m.typ=typ
>>>>
>>>>USE sss in 0
>>>>SELECT tty   &&& add this line
>>>>scan
>>>>   LOCATE FOR tel=m.tel
>>>>     IF FOUND()
>>>>       replace typ with m.typ
>>>>     ELSE
>>>>       replace typ WITH  SPACE(10)
>>>>endif
>>>>endscan
>>>>
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform