按6楼的编程已可解决,但执行编程后,只临时显示一个“查询”表,关闭后,“查询”表也跟着消失了。要怎样才能把“查询”表转化为“结果表”,可随时打开观看?
CREATE CURSOR T (FIELD_NAME C(10),NUM N(4)) && 过渡表
SELECT * FROM 样本表 INTO TABLE TEMP
INSERT INTO TEMP ((FIELD(2))) VALUES (PADC("小计",FSIZE(FIELD(2)),"-"))
FOR I=3 TO FCOUNT()-2
IF TYPE(FIELD(I))="N"
COUNT TO HJ FOR EMPTY(EVALUATE(FIELD(I))) AND RECNO()<RECCOUNT()
REPLACE RECORD RECCOUNT() (FIELD(I)) WITH HJ IN TEMP
INSERT INTO T VALUES ((FIELD(I,[TEMP])),HJ)
ENDIF
ENDFOR
SELECT * FROM T ORDER BY 2 DESC INTO CURSOR TEMP1
LCSTR=[]
SCAN
LCSTR=LCSTR+ALLTRIM(FIELD_NAME)+IIF(RECNO()<RECCOUNT(),[,],[])
ENDSCAN
SELECT 期数,种类,&LCSTR,类别,期号 FROM 样本表
CREATE CURSOR T (FIELD_NAME C(10),NUM N(4)) && 过渡表
SELECT * FROM 样本表 INTO TABLE TEMP
INSERT INTO TEMP ((FIELD(2))) VALUES (PADC("小计",FSIZE(FIELD(2)),"-"))
FOR I=3 TO FCOUNT()-2
IF TYPE(FIELD(I))="N"
COUNT TO HJ FOR EMPTY(EVALUATE(FIELD(I))) AND RECNO()<RECCOUNT()
REPLACE RECORD RECCOUNT() (FIELD(I)) WITH HJ IN TEMP
INSERT INTO T VALUES ((FIELD(I,[TEMP])),HJ)
ENDIF
ENDFOR
SELECT * FROM T ORDER BY 2 DESC INTO CURSOR TEMP1
LCSTR=[]
SCAN
LCSTR=LCSTR+ALLTRIM(FIELD_NAME)+IIF(RECNO()<RECCOUNT(),[,],[])
ENDSCAN
SELECT 期数,种类,&LCSTR,类别,期号 FROM 样本表