Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IndexSeek ... Trap ?
Message
From
26/03/2002 03:39:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/03/2002 03:11:49
Emanuele Bonin
EB Soluzioni Informatiche
Tezze S/B, Italy
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00637120
Message ID:
00637127
Views:
21
>Consider the code below .... if you have an indexed cursor with buffering and you want use indexseek to search for the indexed value field you must issue a go top on the table before use of indexseek else even if your value exist on table, the indexseek will return .f. anyway, if you don't use buffering (buffering = 1) you will haven't problems!
>
>Someone have an explanation for this behavior ?? Is A Bug ?
>Thanx in Advance
>
>** Cut Here
>CREATE CURSOR pippo(codice char(5))
>INDEX ON codice TAG codice
>** With Buffering ie: 3/5 the behavior is different using no buffering (1)
>CURSORSETPROP('buffering', 5, 'pippo')
>
>APPEND BLANK IN Pippo
>REPLACE codice WITH 'CODE'
>
>
>ACTIVATE SCREEN
>CLEAR
>? 'Finding code --------------------------'
>? 'IndexSeek Move ', INDEXSEEK('CODE', .T., 'Pippo', 'codice')
>? 'IndexSeek NoMove ', INDEXSEEK('CODE', .F., 'Pippo', 'codice')
>? 'Seek ', SEEK('CODE', 'Pippo', 'codice')
>SEEK 'CODE' ORDER TAG codice IN Pippo
>? 'FOUND() ', FOUND('pippo')
>
>APPEND BLANK IN Pippo
>REPLACE codice WITH 'CODE22'
>GO TOP IN Pippo
>?
>?
>? 'Finding code2 using GO TOP --------------------------'
>? 'IndexSeek Move ', INDEXSEEK('CODE2', .T., 'Pippo', 'codice')
>? 'IndexSeek NoMove ', INDEXSEEK('CODE2', .F., 'Pippo', 'codice')
>? 'Seek ', SEEK('CODE2', 'Pippo', 'codice')
>SEEK 'CODE2' ORDER TAG codice IN Pippo
>? 'FOUND() ', FOUND('pippo')
>
>USE IN pippo
>** Cut Here

Emanuele,
It's known and intended behaviour, no bug. It's primary usage is to check for existence of key during a new record insertion. If it returned .t. for your newly inserted record then you'd be doing old workarounds to check. Once you move off the record indexseek would return .t. for the newly inserted record regardless of it was row or table buffered.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform