>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
>>>>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.