ALINES(cj,"早,中,晚",",") ALINES(nj,"5,5,3.5",",") CREATE CURSOR tt (xm c(10), j1 c(2), j2 c(2), j3 c(2)) INSERT INTO tt VALUES ("姓名1","早","中","晚") INSERT INTO tt VALUES ("姓名2","中","晚","早") INSERT INTO tt VALUES ("姓名3","早","晚","早") INSERT INTO tt VALUES ("姓名4","晚","中","晚") SELECT *, fun() hj FROM tt FUNCTION fun() LOCAL i,ret ret = 0 FOR i=2 TO FCOUNT() ret = ret + VAL(nj[ASCAN(cj,EVALUATE(FIELD(i)))]) ENDFOR RETURN ret ENDFUNC
CREATE CURSOR tt (xm c(10), hj n(6,2), a01 c(4), a02 c(4), a03 c(4)) INSERT INTO tt VALUES ("aaa", 0, "中", "早", "晚") INSERT INTO tt VALUES ("bbb", 0, "晚", "晚", "晚") INSERT INTO tt VALUES ("ccc", 0, "中", "早", "早") SCAN lnsum = 0 FOR ln = 3 TO FCOUNT() lnsum = lnsum + IIF(INLIST(EVALUATE(FIELD(ln)), "中", "早"), 5, 3.5) ENDFOR REPLACE hj WITH lnsum ENDSCAN BROWSE