回复 10楼 fdqzy
要着具体是怎样使用这些变量类似问题之前的贴有讨论过重复使用变量kk
CLOSE TABLES all USE fc\b4 REPLACE ALL ; md1 WITH IIF(OCCURS("_", _1D + _2D + _3D)=1,"MD1", ""); md2 WITH IIF(OCCURS("_", _1D + _2D + _3D)=2,"MD2", ""); md3 WITH IIF(OCCURS("_", _1D + _2D + _3D)=3,"MD3", ""); REPLACE ALL ; mx1 WITH IIF(OCCURS("_", _1X + _2X + _3X)=1,"MX1", ""); mx2 WITH IIF(OCCURS("_", _1X + _2X + _3X)=2,"MX2", ""); mx3 WITH IIF(OCCURS("_", _1X + _2X + _3X)=3,"MX3", "")
CLOSE TABLES all USE b4 BLANK FIELDS md1,md2,md3,mx1,mx2,mx3 ALL kk1=0 kk2=0 REPLACE ALL ; md1 WITH IIF(fun()=1,"MD1", ""); md2 WITH IIF(kk1=2,"MD2", ""); md3 WITH IIF(kk1=3,"MD3", "") REPLACE ALL ; mx1 WITH IIF(fun1()=1,"MX1", ""); mx2 WITH IIF(kk2=2,"MX2", ""); mx3 WITH IIF(kk2=3,"MX3", "") RETURN FUNCTION fun() kk1=OCCURS("_", _1D + _2D + _3D) RETURN kk1 ENDFUNC FUNCTION fun1() kk2=OCCURS("_", _1X + _2X + _3X) RETURN kk2 ENDFUNC
FUNCTION fun() kk1 = OCCURS("_", _1D + _2D + _3D) kk2 = OCCURS("_", _1X + _2X + _3X) RETURN kk1 ENDFUNC FUNCTION fun1() ****** ENDFUNC FUNCTION fun2() ****** ENDFUNC
SET PROCEDURE TO funs.prg ADDITIVE PRIVATE kk1,kk2 kk1 = 0 kk2 = 0 USE b4 REPLACE ALL ; md1 WITH IIF(fun()==1, "MD1", ""),; md2 WITH IIF(kk1==2, "MD2", ""),; md3 WITH IIF(kk1==3, "MD3", ""),; mx1 WITH IIF(kk2==1, "MX1", ""),; mx2 WITH IIF(kk2==2, "MX2", ""),; mx3 WITH IIF(kk2==3, "MX3", "") RELEASE PROCEDURE funs.prg SELECT * FROM b4
USE b1 IN 0 ALIAS t1 USE b1 IN 0 ALIAS t2 AGAIN SELECT t1 SET RELATION TO RECNO()+1 INTO "t2" SCAN tj=0 if '_'$t1._1d and '_'$t2._1d &&两表上下相同 tj=tj+1 endif if '_'$t1._2d and '_'$t2._2d tj=tj+1 ENDIF if '_'$t1._3d and '_'$t2._3d tj=tj+1 ENDIF REPLACE t2.mdx1 WITH IIF(tj=1, 'MDX1', ''); t2.mdx2 WITH IIF(tj=2, 'MDX2', ''); t2.mdx3 WITH IIF(tj=3, 'MDX3', '') ENDSCAN
[此贴子已经被作者于2020-9-24 17:59编辑过]
USE b1 IN 0 ALIAS t1 USE b1 IN 0 ALIAS t2 AGAIN SELECT t1 SET RELATION TO RECNO()+1 INTO "t2" PRIVATE tj tj = 0 REPLACE ALL ; t2.mdx1 WITH IIF(fun()=1, 'MDX1', ''),; t2.mdx2 WITH IIF(tj=2, 'MDX2', ''),; t2.mdx3 WITH IIF(tj=3, 'MDX3', '') SELECT * FROM b1 RETURN FUNCTION fun() tj = IIF('_'$t1._1d and '_'$t2._1d, 1, 0) tj = tj + IIF('_'$t1._2d and '_'$t2._2d, 1, 0) tj = tj + IIF('_'$t1._3d and '_'$t2._3d, 1, 0) RETURN tj ENDFUNC
FUNCTION fun1() kk1...... kk2...... ...... kk20..... RETURN kk1 ENDFUNC FUNCTION fun2() bb1...... bb2...... ...... bb15.. ENDFUNC
SET PROCEDURE TO funs1.prg ADDITIVE ......
SET PROCEDURE TO funs2.prg ADDITIVE .....