dc_setscopearray() is a very powerfull tool to use. I use it quite a lot. Sometimes I encountered a problem with record position. I found that the dc_dbgoto() isn't working.
See the sample below, is can be used with any database and index if there are at least 100 records. Just change dbffile and ntxfile to the correct names.
dc_dbskip(0) is also doing something weird. However, this isn't used in my application.
Code: Select all
use dbffile alias customer new
set index to ntxfile
for x = 1 to 100 step 3
aadd(aRecords,x)
next
customer->(dc_setscopearray(aRecords))
customer->(dc_dbgotop())
wtf customer->(recno()) // 1
customer->(dc_dbskip(1))
wtf customer->(recno()) // 4
customer->(dc_dbskip(1))
wtf customer->(recno()) // 7
customer->(dc_dbgoto(31))
wtf " goto 31 " , customer->(recno()) // should be 31 but stays on 7
customer->(dc_dbskip(1))
wtf customer->(recno()) // 10
customer->(dc_dbskip(1))
wtf customer->(recno()) // 13
customer->(dc_dbskip(0))
wtf "skip 0 " , customer->(recno()) // last record in file, in my test record 129
customer->(dc_dbgoto(31))
wtf "goto 31 " , customer->(recno()) // should be 31 but stays on 129.
customer->(dc_dbgobottom())
wtf "bottom" , customer->(recno()) // 100