标题:求助:用VFP分类统计问卷的问题
只看楼主
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:323
帖 子:9621
专家分:26174
注 册:2012-2-5
得分:0 
程序代码:
SET COLLATE TO "MACHINE" 
CREATE CURSOR tjhzb (zdm c(10), xmxh c(2), xmnr c(120), yb0 n(4), jg0 n(4), yb1 n(4), jg1 n(4), yb2 n(4), jg2 n(4), yb3 n(4), jg3 n(4))
CREATE TABLE tjb (zdm c(10), xmxh c(2), xmnr c(120), yb0 n(4), jg0 n(4), yb1 n(4), jg1 n(4), yb2 n(4), jg2 n(4), yb3 n(4), jg3 n(4))
SELECT DISTINCT zdm FROM dmztjm INTO CURSOR temp1
SCAN FOR BETWEEN(RECNO(), 2, 10)
    c1 = zdm
    INSERT INTO tjb (zdm, xmxh, xmnr) SELECT zdm, xmxh, xmnr FROM dmztjm WHERE ALLTRIM(zdm) == c1
    SELECT tjb
    INDEX on zdm + xmxh TAG dmxh
    SELECT bm, c1 zdm, a1, &c1 FROM ztjm INTO CURSOR temp2
    SET RELATION TO zdm + &c1 INTO tjb
    SCAN 
        IF EMPTY(a1)
            c2 = "Yb0"
        ELSE 
            c2 = "Yb" + temp2.a1
        ENDIF 
        REPLACE (c2) WITH EVALUATE(c2) + 1, yb3 WITH yb0 + yb1 + yb2 IN tjb
    ENDSCAN
    SELECT tjb
    SET ORDER TO
    INSERT INTO tjb (xmnr, yb0, yb1, yb2, yb3) SELECT "合计", SUM(yb0), SUM(yb1), SUM(yb2), SUM(yb0) + SUM(yb1) + SUM(yb2) FROM tjb
    INSERT INTO tjhzb SELECT * FROM tjb WHERE NOT EMPTY(yb3)
    ZAP IN tjb
ENDSCAN
SELECT tjhzb
browse
USE IN tjb
ERASE tjb.dbf
收到的鲜花
  • superdonaldd2020-07-21 11:09 送鲜花  2朵   附言:谢谢版主

坚守VFP最后的阵地
2020-06-30 09:58
superdonaldd
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2020-6-29
得分:0 
回复 11楼 sdta
谢谢版主,我研究一下,不懂的再找您请教
2020-06-30 10:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-502325-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.122346 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved