2012-02-17 70 views
0

我有一個動態的Browser.It將dynamicaly基礎上,通過UI給予一定的輸入填充值。Geeting價值觀和創建臨時表

現在我婉得到在瀏覽顯示的值,使一個臨時表了點。 請幫助

+0

我不知道你在問什麼,因爲在瀏覽顯示的值必須在任何一個TT或數據庫表。 – 2012-02-17 12:48:01

回答

2

要添加新的價值觀,你先插入一個新行到臨時表,然後安排要更新該行。下面的代碼是醜陋的,但它可以說明:

define temp-table tt_simple no-undo 
    field id as integer 
    field name as character 
    index id_idx is unique id 
. 

define variable r as integer no-undo. 

define query q for tt_simple. 

define browse b query q display tt_simple.name with 5 down. 

form b with frame easy. 

form 
    tt_simple.name 
with 
    frame updEasy 
    column 30 
    row 1 
. 

procedure newRecord: 
    define input parameter initName as character no-undo. 
    create tt_simple. 
    assign 
    r = r + 1 
    id = r 
    name = initName 
    . 
end. 

run newRecord("abc"). 
run newRecord("xyz"). 

on "enter" of b in frame easy do: 
    apply "entry" to tt_simple.name in frame updEasy. 
    return no-apply. 
end. 

on "insert-mode", "CTRL-I" anywhere do: 
    run newRecord(""). 
    close query q. 
    open query q for each tt_simple. 
    get last q. 
    apply "entry" to tt_simple.name in frame updEasy. 
    return no-apply. 
end. 

on "go" of tt_simple.name in frame updEasy do: 
    tt_simple.name = self:screen-value. 
    close query q. 
    open query q for each tt_simple. 
    apply "entry" to b in frame easy. 
    return no-apply. 
end. 

on "value-changed" of b in frame easy do: 
    display tt_simple.name with frame updEasy. 
end. 

open query q for each tt_simple. 

enable tt_simple.name with frame updEasy. 
enable b with frame easy. 
apply "entry" to b in frame easy. 

wait-for "close" of this-procedure.