CREATE CURSOR t1(a1 c(10),a2 B(2),a3 F(6,2),a4 I,b1 c(10),b2 n(6,2),c1 n(7,2))
INSERT INTO t1(a1,a2,a3,a4,b1,b2) VALUES ('001',11,11,11,'011',100)
INSERT INTO t1(a1,a2,a3,a4,b1,b2) VALUES ('002',22,22,22,'022',100)
INSERT INTO t1(a1,a2,a3,a4,b1,b2) VALUES ('003',22,33,33,'033',100)
INSERT INTO t1(a1,a2,a3,a4,b1,b2) VALUES ('004',22,44,44,'044',100)
BROWSE
nCnt=AFIELDS(aMyAry) &&把字段总数给变量 nCnt,字段信息给数组 aMyAry
SCAN
nCount = 0 &&汇总结果
FOR i=1 TO nCnt
If INLIST(aMyAry(i,2),"B","F","I","N") &&只汇总数据类型字段
nCount = nCount + &aMyAry(i,1)
EndIf
EndFor
Repl c1 with nCount
EndScan
BROWSE