求连续出现的最大值
如表:
bmax.rar
(271 Bytes)
条件:
1、对连续出现“M1ZR”的个数统计,
2、对连续出现个数在前10行中(含第10行)进行比较,连续出现数为最大值时,在对应的字段"m1zrmax"标注 “M1ZRMAX”
如表中第10、14、24、32、42行.
谢谢!
[此贴子已经被作者于2021-6-25 10:47编辑过]
DIMENSION arr[1] ar = 0 n = 0 m = 0 nMax = 0 USE bmax BLANK FIELDS m1zrmax ALL SCAN IF ALLTRIM(m1zr)=="M1ZR" m = m +1 IF m > nMax nMax = m n = RECNO() ENDIF ELSE m = 0 ENDIF IF RECNO()%10==0 AND n>0 ar = ar + 1 DIMENSION arr[ar] arr[ar] = n n = 0 m = 0 nMax = 0 ENDIF ENDSCAN IF n > 0 ar = ar + 1 DIMENSION arr[ar] arr[ar] = n ENDIF FOR i=1 TO ALEN(arr) GO arr[i] REPLACE m1zrmax WITH "M1ZRMAX" ENDFOR SELECT * FROM bmax
[此贴子已经被作者于2021-6-25 15:09编辑过]