Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check duplicate in table buffered mode?
Message
From
19/10/1997 00:05:07
Shihchau Tai
Apic Systems Pte Ltd
Singapore, Singapore
 
 
To
18/10/1997 14:30:48
Juan Kh
Dataprop Technologies
Sungai Petani, Malaysia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00055264
Message ID:
00055327
Views:
28
>>How do I check for duplicate in table buffered mode? Do I have to do a 'COPY TO' a temp table before I check? It seems troublesome.
>>
>>This table buffering is really killing my time. Can someone please comment?
>
>Hi,
>
>You have two situations:
>
>1) You are trying to search for a duplicate which is already in the table.
>2) You are trying to search for a duplicate which you have just entered into the bufferedd table (the one that has RECNO() less than 0)
>
>If you are dealing with case #1, try to USE YourTable IN 0 AGAIN ALIAS AnotherName. Issue a SEEK command (provided your search is on an indexed field)
>
>For case #2, try the following code (may be slow for big table)
>
>
>llRetVal = .T.
>SELECT YourTable
>SET ORDER TO YourIndexedField ASCENDING && Seek from TOP
>lnRecNo = RECNO() && Remember where you are
>cKey = YourValueToSeek
>IF SEEK(cKey)
> IF lnRecNo RECNO() && Found and is not where I was??
> && It is duplicate, Do something.
> llRetVal = .F.
> ENDIF
>ENDIF
>
>*-- If not found from the TOP, try to seek from the bottom
>IF llRetVal
> SELECT YourTable
> SET ORDER TO YourIndexedField DESCENDING && Seek from BOTTOM
> lnRecNo = RECNO()
> cKey = YourValueToSeek
> IF SEEK(cKey)
> IF lnRecNo RECNO()
> && It is duplicate, Do something.
> llRetVal = .F.
>
> ENDIF
> ENDIF

Wow! Thx. I will try this. MS should provide a function for that.
>ENDIF
>
>
>juan
Previous
Reply
Map
View

Click here to load this message in the networking platform