0

我已经创建了一个动态临时表和动态查询。现在我想将它填充到浏览中。这是我的代码。我的问题是它显示错误,例如“缓冲区复制语句的源元素没有记录(5365)” . 这个怎么解决?cip-tablename = 从 UI 获取的 tableName

CREATE BUFFER hBuffer FOR TABLE cip-tablename.


CREATE QUERY hQuery.        /*this query I need for some other logic.
hQuery:SET-BUFFERS(hBuffer).
hQuery:QUERY-PREPARE("FOR EACH " + cip-tablename + " WHERE " + cip-condition).
hQuery:QUERY-OPEN().


create temp-table hTT.
hTT:Create-Like(cip-tablename).
hTT:temp-table-prepare("tt" + cip-tablename).

hTTb = htt:default-buffer-handle.
hTTb:buffer-create().
hTTb:buffer-copy(hBuffer).


CREATE QUERY hQuery1.
hQuery1:SET-BUFFERS(hTTbh).
hQuery1:QUERY-PREPARE("for each tt " + cip-tablename).
hQuery1:QUERY-OPEN().

CREATE BROWSE hbrowse-hdl1
ASSIGN
TITLE     = cip-tablename + " Browse"
FRAME     = Frame DetailsFrame:Handle
QUERY     = hQuery1
X         = 48
Y         = 100
WIDTH     = 96
DOWN      = 10
VISIBLE   = YES
SENSITIVE = TRUE
READ-ONLY = yes.
hbrowse-hdl1:ADD-COLUMNS-FROM(hTTbh).
4

1 回答 1

2

您缺少一些将数据从源查询复制到 TT 的代码:

hQuery:Get-FIRST(no-lock).

DO WHILE hbuffer:AVAILABLE:

   hTTb:buffer-create().
   hTTb:buffer-copy(hBuffer).
   hQuery:Get-NEXT(no-lock).

END.

坦率地说,只显示源表中的浏览会更容易。

于 2012-02-23T14:25:17.093 回答