下面的example打开 testdata 数据库中的 customer 表,应用 for ... endfor 语句创建一个循环,在此循环中检查 customer 结构索引中每个索引标识的主索引状态,然后显示每个结构索引标识名称以及其主索引状态。
close databases
set path to (home(2) + 'data\') && sets path to database
open database testdata && open testdata database
use customer && open customer table
for ncount = 1 to 254
if !empty(tag(ncount)) && checks for tags in the index
? tag(ncount) && display tag name
? primary(ncount) && display primary status
else
exit && exit the loop when no more tags are found
endif
endfor