4GL ABL Openedge 循环通过句柄?

4GL ABL Openedge loop through handle?

这是我当前的代码

def var hbTT as handle.

for each Cust:
  hbTT:buffer-create().
  assign
    hbTT::Name    = Cust.Name
    hbTT::address = Cust.Address.
end.

现在我要做的是循环hbtt。我怎样才能做到这一点?

我试过了

for each hbTT:
  /* Do something */
end.

我得到的错误是

unknown or ambiguous table hbTT. (725)

谢谢

您将无法以这种方式进行循环,因为每个循环都需要一个静态名称。 相反,试试这个:

DEFINE VARIABLE hQuery AS HANDLE      NO-UNDO.

create query hQuery.
hQuery:set-buffers(hbtt).
hquery:query-prepare('for each tt'). /* <-- Where tt is the original buffer name */
hquery:query-open().

hquery:get-first().
do while not hquery:query-off-end:
    disp hbtt::name hbtt::address .
    hquery:get-next().
end.