怎么编码?这是通用问题,只要解决一种产品就可以了
程序代码:
CREATE CURSOR 路径表 (路径 C(240)) INDEX on 路径 TAG 路径 CREATE CURSOR 表b (xh I, id1 I, id2 I, th C(20), mc C(20)) INSERT INTO 表b VALUES (1, 1, 0, "YC1291-3序3", "扁钢") INSERT INTO 表b VALUES (2, 1, 0, "YC1291-4", "扣紧件") INSERT INTO 表b VALUES (3, 0, 1, "YC1291-4序1", "斜片") INSERT INTO 表b VALUES (4, 0, 1, "YC1291-4序2", "钢管") INSERT INTO 表b VALUES (5, 0, 2, "YC1291-5", "扁钢") INSERT INTO 表b VALUES (6, 0, 2, "YC1291-6", "圆钢") INSERT INTO 表b VALUES (7, 0, 6, "YC1291L-4", "扣紧件") INSERT INTO 表b VALUES (8, 0, 7, "YC1291L-4序", "斜片") INSERT INTO 表b VALUES (9, 0, 6, "YC1291Y-1", "外门框") INSERT INTO 表b VALUES (10, 0, 9, "YC1291Y-1序3", "钢板") SCAN INSERT INTO 路径表 VALUES (取路径("表b", 表b.xh)) ENDSCAN SELECT 路径表 GO TOP BROWSE FUNCTION 取路径(c树型表, nID) LOCAL c路径, nRec c路径 = "" SELECT (c树型表) IF BETWEEN(nID, 1, RECCOUNT()) nRec = nID GO nID c路径 = TRANSFORM(xh) nID = id2 DO WHILE (nID > 0) && 遍历父ID GO nID c路径 = TRANSFORM(xh) + "\" + c路径 nID = id2 ENDDO GO nRec ENDIF RETURN c路径 ENDFUNC