程序代码:
CLEAR CREATE CURSOR kbtmp (jsmc c(10),skcs i,rw c(254)) &&如果内容太多可用CREATE CURSOR kb (jsmc c(10),skcs i,rw m) *APPEND BLANK SELECT jsmd GOTO top rkmc="" SCAN cxm=ALLTRIM(xm) iskcs=0&&上课次数 * ?cxm, rkmc=cxm+"," SELECT jsrkb GOTO top SCAN FOR i=1 TO 18 m=FIELD(i) xm2= &m. IF ALLTRIM(xm2)==cxm &&不用== alltr()意义不太 rkmc=rkmc+FIELD(i)+nj+bj+',' iskcs=iskcs+1 ENDIF NEXT i ENDSCAN * ?rkmc * WAIT IF iskcs>0 &&无课的不统计 SELECT kbtmp APPEND BLANK REPLACE jsmc WITH cxm,skcs WITH iskcs,rw WITH rkmc endif SELECT jsmd ENDSCAN SELECT kbtmp REPLACE rw WITH ALLTRIM(STR(RECNO()))+'、'+rw ALL COPY TO 课表 FIELDS rw sdf
基本是这样了。
上面输入结果有多余空格和‘,’。下面这样就好了。
程序代码:
CLEAR CREATE CURSOR kbtmp (rw m) APPEND BLANK IF !USED('jsmd') USE jsmd IN 0 ENDIF IF !USED('jsrkb') USE jsrkb IN 0 ENDIF SELECT jsmd GOTO top rkmc="" xh=0 SCAN cxm=ALLTRIM(xm) iskcs=0&&上课次数 rkmc=cxm+"," SELECT jsrkb GOTO top SCAN FOR i=1 TO 18 m=FIELD(i) xm2= &m. IF ALLTRIM(xm2)==cxm &&不用== alltr()意义不太 rkmc=rkmc+FIELD(i)+nj+bj+',' iskcs=iskcs+1 ENDIF NEXT i ENDSCAN IF iskcs>0 &&无课的不统计 xh=xh+1 rkmc= ALLTRIM(STR(xh))+'、'+LEFT(rkmc,RAT(',',rkmc)-1)+CHR(13)+CHR(10) SELECT kbtmp REPLACE rw WITH rw+rkmc endif SELECT jsmd ENDSCAN SELECT kbtmp COPY MEMO rw TO 课表 CLEAR CREATE CURSOR kbtmp (rw m) APPEND BLANK IF !USED('jsmd') USE jsmd IN 0 ENDIF IF !USED('jsrkb') USE jsrkb IN 0 ENDIF SELECT jsmd GOTO top rkmc="" xh=0 SCAN cxm=ALLTRIM(xm) iskcs=0&&上课次数 rkmc=cxm+"," SELECT jsrkb GOTO top SCAN FOR i=1 TO 18 m=FIELD(i) xm2= &m. IF ALLTRIM(xm2)==cxm &&不用== alltr()意义不太 rkmc=rkmc+FIELD(i)+nj+bj+',' iskcs=iskcs+1 ENDIF NEXT i ENDSCAN IF iskcs>0 &&无课的不统计 xh=xh+1 rkmc= ALLTRIM(STR(xh))+'、'+LEFT(rkmc,RAT(',',rkmc)-1)+CHR(13)+CHR(10) SELECT kbtmp REPLACE rw WITH rw+rkmc endif SELECT jsmd ENDSCAN SELECT kbtmp COPY MEMO rw TO 课表
[此贴子已经被作者于2020-3-19 13:52编辑过]
dBase有人接盘了。