这是向 WF 查询的一种非常复杂的方式!
这段代码,它用于加载您在图像中显示的数据:
-*
-* FILE ALLOCATION
-*
FILEDEF AMDEXAM DISK amdexam.ftm (APPEND
-RUN
-*
-* MASTER TO READ AMDS EXAMPLE
-*
EX -LINES 5 EDAPUT MASTER,AMDEXAM,CV,FILE
FILENAME=AMDEXAM, SUFFIX=FIX, SEGNAME=AMDEXAM, SEGTYPE=S0, $
FIELD=ID ,ALIAS=ID ,USAGE=A5 ,ACTUAL=A5 ,$
FIELD=NAME ,ALIAS=NAME ,USAGE=A10 ,ACTUAL=A10 ,$
FIELD=GRADE ,ALIAS=GRADE ,USAGE=A1 ,ACTUAL=A1 ,$
-*
-* LOAD FILE WITH SOME RECORDS
-*
-WRITE AMDEXAM A1 Brian A
-WRITE AMDEXAM A1 Brian B
-WRITE AMDEXAM A1 Brian B
-WRITE AMDEXAM A1 Brian A
-WRITE AMDEXAM A1 Brian C
-WRITE AMDEXAM A1 Brian F
-WRITE AMDEXAM A1 Brian F
-WRITE AMDEXAM A2 Jack F
-WRITE AMDEXAM A2 Jack F
-WRITE AMDEXAM A2 Mystic B
-WRITE AMDEXAM A3 Mystic A
-WRITE AMDEXAM A3 Mystic C
-WRITE AMDEXAM A3 Mystic C
-WRITE AMDEXAM A4 Joe F
-WRITE AMDEXAM A4 Joe F
-WRITE AMDEXAM A4 Ruben B
-WRITE AMDEXAM A4 Ruben A
-*
您可以尝试这样的事情来实现您的要求:
TABLE FILE AMDEXAM
SUM
COMPUTE AA/I1 = IF ((LAST NAME NE NAME AND GRADE NE 'F') OR (LAST NAME EQ NAME AND LAST AA EQ 1)) THEN 1 ELSE 0; NOPRINT
BY ID
BY NAME
BY GRADE
WHERE TOTAL AA EQ 0
ON TABLE SET BYDISPLAY ON
END
-RUN
-EXIT
那应该给你布莱恩的成绩。
编辑:将动词从 PRINT 更改为 SUM 以仅获取一条记录,将 NOPRINT 更改为字段 AA。