Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find record position in an indexed table
Message
From
24/08/2006 18:26:34
 
 
To
24/08/2006 18:20:45
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01148310
Message ID:
01148408
Views:
21
>>>>>Hello,
>>>>>
>>>>> How to find the position of a record in an indexed table.
>>>>>RECNO() will give the position of the record in the table but how to find the position in an indexed table.
>>>>>
>>>>>TIA
>>>>
>>>>For Versions of VFP previous to 9, if the table is small (under 65,000 rows), you could do a SQL SELECT of the primary keys into an array in the order of the index key. Then do an ASCAN to find your primary key. The element of the array would be the indexed order.
>>>
>>>Fred! That's brilliant!
>>>
>>
>>Sure ?
>
>It is a great concept.
>

no, it is useless.

>>ASCAN is equal to a ordered count
>
>Yes.


>
>>
>>>You could expand that to a cursor! select pk order by indexkey. locate for pk = m.pk
>>>
>>
>>If you want gain something:
>>
>>SELECT pk from table order by 1 ...
>>INDEX ON pk tag tagpos && without this, the locate is equal to the ordered count, again
>>SEEK m.pk
>>? recno()
>>
>
>Only if the index is used in several subsequent seeks.
>

without the index, this solution is useless

>>
>>>recno is then the relative position.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform