解决方法
如果您使用的是4GL,您可能还希望使用OPEN QUERY和MAX-ROWS来实现您正在寻找的结果.下面显示了一个带有计数器的传统FOR EACH循环,然后是带有MAX-ROWS的QUERY:
define variable i as integer no-undo. define frame a with 10 down. for each customer no-lock break by name: i = i + 1. display i custNum name discount. if i >= 5 then leave. end. define query q for customer scrolling. open query q for each customer no-lock break by name max-rows 5. do i = 1 to 5 with frame a: get next q. display i custNum name discount. end.