>Hi all,
>
>I have two problems:
>
>1.)
>I have table. From this table I want create cursor where get to all record in this cursor number for his position in cursor.
>First record in cursor have "position" 1, second record in cursor have
>"position" 2, ....
>The "position" is new column in cursor.
>How Can I solve this problem ?
>
>2.)
>How Can I create SELECT (cursor), where load only one record with specified position by ORDER item.
>Example: I want get only 5th record from table ordered by "name" ("name" is index column in table)
>
>Thanks.
Martin,
If I read you correct you won't need that position column (recno() of new cursor ?). Anyway :
select reccount() as position,* from myTable ;
order by myOrder ;
into cursor myTmpCrs nofilter
use dbf("myTmpCrs") in 0 again alias myCursor
use in "myTmpCrs"
select myCursor
replace all position with recno()
For second I think you would need a second select from "myCursor" :
select * from myCursor ;
where position = 5 ...
You could drop usage of replace in first and the second SQL for the latter with UDF and subqueries, but I think you won't gain performance doing so.
Cetin