以前确实没有遇到过索引后新排序的顺序号需求,现在有一个情况就是一个表有4-5个索引,需要知道记录A在不同索引下各自的排名情况,
例:
use mytab order quan1
求记录A在表中排位
use mytab order sales1
求记录A在表中排位
等等...
用sql语句确实可以解决,如果有个函数...想省点事
做个函数吧,比如:
Function recnindex(filename,记录号)
&& filename: 已经做索引的数据表文件名
&& 记录号=“记录A”的记录号recn()
local xretu
select &xfilename
xretu = 0
go top
do while !eof() AND recn()#记录号
xretu = xretu + 1
skip
enddo
retu xretu