以下是引用吹水佬在2020-9-13 19:57:05的发言:
k11、p11等变量只获取了一条记录的数据
REPLACE ALL 是处理所有记录数据
k11、p11等变量只获取了一条记录的数据
REPLACE ALL 是处理所有记录数据
因数据结构需要,要多次用到列变量,应如何处理?再嵌套循环吗?
USE b1 IN 0 ALIAS t1 USE b1 IN 0 ALIAS t2 AGAIN SELECT t1 SET RELATION TO RECNO()+1 INTO "t2" p1=ALLTRIM("t1.")+ALLTRIM('a')+ALLTRIM('1') && 按实际定义动态运算表达式 k1=ALLTRIM("t2.")+ALLTRIM('a')+ALLTRIM('1') p2=ALLTRIM("t1.")+ALLTRIM('a')+ALLTRIM('2') k2=ALLTRIM("t2.")+ALLTRIM('a')+ALLTRIM('2') REPLACE ALL t2._1d WITH IIF(EVALUATE(k1+">"+p1), "_1D", ""); t2._1x WITH IIF(EVALUATE(k1+"<"+p1), "_1X", ""); t2._1t WITH IIF(EVALUATE(k1+"="+p1), "_1T", ""); t2._2d WITH IIF(EVALUATE(k2+">"+p2), "_2D", ""); t2._2x WITH IIF(EVALUATE(k2+"<"+p2), "_2X", ""); t2._2t WITH IIF(EVALUATE(k2+"="+p2), "_2T", "") SET RELATION TO SELECT * FROM t1
CLOSE TABLES all USE b4 GO 1 &&固定被比较的行 k1=_1d k2=_1x k3=_1t FOR i=2 TO RECCOUNT() &&以下数据与第1行数据比较 GO i REPLACE _1dxx WITH '_1DXX' FOR '_'$k1 AND '_'$_1d AND RECNO()=i &&与第1行同列值相同 REPLACE _1dxx WITH '_1DXX' FOR '_'$k2 AND '_'$_1x AND RECNO()=i REPLACE _1dxx WITH '_1DXX' FOR '_'$k3 AND '_'$_1t AND RECNO()=i REPLACE _1dxxf WITH '_1DXXF' FOR NOT '_'$_1dxx AND ('_'$k1 OR '_'$k2 OR '_'$k3) AND RECNO()=i endfor
[此贴子已经被作者于2020-9-14 15:57编辑过]
[此贴子已经被作者于2020-9-14 19:53编辑过]
CLOSE TABLES all USE b1 IN 0 ALIAS t1 BLANK FIELDS s1_3,s4 all For i=10 To RECCOUNT() GO i p1=ALLTRIM('a')+ALLTRIM('1') p11=&p1 &&确定要统计个数的对象 qs=jnh Select * From t1 Where jnh>qs-10 And jnh<=qs Into Cursor ls &&筛选10行数据 Count For a1=p11 Or a2=p11 To tj &&对筛选数据统计 Use Select t1 GO i REPLACE s1_3 with 'S1_3' for tj>0 AND tj<=3 AND RECNO()=i REPLACE s4 with 'S4' for tj>3 AND RECNO()=i ENDFOR brow