以下是引用吹水佬在2021-6-25 18:20:34的发言:
还有这种情况:31、32行和41、42行
USE bmax
BLANK FIELDS m1zrmax ALL
FOR nRec=1 TO RECCOUNT() &&-10
n = 0
m = 0
nMax = 0
GO nRec
SCAN NEXT 10
IF ALLTRIM(m1zr)=="M1ZR"
m = m + 1
IF m > nMax
nMax = m
n = RECNO()
ENDIF
ELSE
m = 0
ENDIF
ENDSCAN
IF n > 0
GO n
IF nMax > VAL(m1zrmax)
REPLACE m1zrmax WITH TRANSFORM(nMax)
ENDIF
ENDIF
ENDFOR
SELECT * FROM bmax
还有这种情况:31、32行和41、42行
USE bmax
BLANK FIELDS m1zrmax ALL
FOR nRec=1 TO RECCOUNT() &&-10
n = 0
m = 0
nMax = 0
GO nRec
SCAN NEXT 10
IF ALLTRIM(m1zr)=="M1ZR"
m = m + 1
IF m > nMax
nMax = m
n = RECNO()
ENDIF
ELSE
m = 0
ENDIF
ENDSCAN
IF n > 0
GO n
IF nMax > VAL(m1zrmax)
REPLACE m1zrmax WITH TRANSFORM(nMax)
ENDIF
ENDIF
ENDFOR
SELECT * FROM bmax
代码有点不合要求:
1-10行比较,若第10行不为空,最大值标注在第10行;
2-11行比较,若第11行不为空,最大值标注在第11行;
.......