求助:关于学生成绩转等级问题
现有两个表:一个成绩表,内有姓名,各科成绩和各科等级字段(其他字段可忽略),另一个为参数等级表,内有等级、等级分数、等级说明和科目字段,现想求助,如何根据参数等级表的内容把成绩表的各科成绩转化为相应的等级。谢谢!(参数等级表里有百分数的记录可忽略,只要求根据有科目的记录转化)
等级转换.rar
(42.1 KB)
CLOSE DATABASES USE cjb IN 0 USE 等级参数 IN 0 ALIAS cs SELECT cs SCAN REPLACE (ALLTRIM(cs.科目) + "等级") WITH cs.等级 IN cjb FOR EVALUATE(cs.科目) >= cs.fs1 AND EVALUATE(cs.科目) < cs.fs2 ENDSCAN SELECT cjb BROWSE
CLOSE TABLES all USE 成绩表2020至2021学年上学期七年级学科竞赛成绩 ALIAS cj FOR i=1 TO FCOUNT() czdm=FIELD(i) IF '等级'$czdm REPLACE &czdm. WITH '' all endif ENDFOR SELECT RECNO() xh ,科目 km, 等级名称 dj,等级分数 fsd FROM 等级参数 INTO CURSOR djtmp ORDER BY km,fsd DESC WHERE !EMPTY(科目)readw ALTER table djtmp ADD fsg n(6,2) null ALTER table djtmp alter fsd n(6,2) REPLACE xh WITH RECNO() all REPLACE fsg WITH 0 FOR fsd=0 SELECT xh+1 xh,fsd fs FROM djtmp INTO CURSOR tmp SELECT djtmp UPDATE djtmp SET fsg =(select fs from tmp WHERE tmp.xh=djtmp.xh) REPLACE fsg WITH fsg-0.01 all REPLACE fsd WITH 0.01 FOR fsd=0 REPLACE fsg WITH 300 FOR fsg=-0.01 OR ISNULL(fsg) SCAN kmzd=ALLTRIM(km) cjzd=kmzd+'等级' cdj=ALLTRIM(dj) cj1=fsd cj2=fsg REPLACE &cjzd WITH cdj FOR BETWEEN(&kmzd.,cj1,cj2) IN cj ENDSCAN