2012-02-23 69 views
0

我已經創建了一個動態臨時表和動態查詢。現在我想填充到browse.Here是我的code.My問題是它顯示錯誤,如「源元素的緩衝區複製語句沒有記錄(5365 )」。 如何解決這個問題? CIP-表名=表名從UI從臨時表中填充瀏覽器中的數據?

越來越
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). 
+1

我不完全明白這個問題。代碼中的一個問題可能是hQuery1:SET-BUFFERS(hTTbh)。可能無法工作,因爲任何地方都沒有「hTTbh」,第二個問題可能是下一行hQuery1:QUERY-PREPARE(「對於每個tt」+ cip-tablename)。這裏查詢字符串準備一個表名爲xxx的計算結果爲「對於每個tt xxx」,但是你進一步調用了temp-table ttxxx ......(hTT:temp-table-prepare(「tt」+ cip-tablename) 。) – LyrixDeRaven 2012-02-23 13:36:48

回答

2

你錯過了一些代碼,從源查詢數據複製到TT:

hQuery:Get-FIRST(no-lock). 

DO WHILE hbuffer:AVAILABLE: 

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

END. 

坦率地說,它會更容易只顯示從源表中瀏覽。