2012-12-06 49 views
0

我嘗試下面的代碼:我使用進展4GL並試圖動態地更改列標籤,這可能

def temp-table tt-dg1 
    field dtoday as date column-label "dg " 
    . 

buffer tt-dg1:BUFFER-FIELD("dtoday"): 
column-LABEL = buffer tt-dg1:BUFFER-FIELD("dtoday"):column-LABEL + "77". 

display buffer tt-dg1:BUFFER-FIELD("dtoday"):column-LABEL. 

create tt-dg1. 
dtoday = today. 

display tt-dg1 with frame f2. 

期待現場dtoday到現在有dg 77列標籤,但它仍然dg ,我需要這個將週數添加到我創建的電子表格的標準列標籤中。

任何幫助感激地收到:)

回答

0

這感覺就像一個過錯。 在臨時表中重寫它時,它似乎不起作用。

如果您在顯示之前在一個框架中定義了您的字段,那麼您可以在此處將其覆蓋。

form tt-dg1.dtoday with frame f2. 
tt-dg1.dtoday:label = "MyLabel". 
display tt-dg1.dtoday with frame f2. 

這可能有助於取決於你在做什麼。

+0

感謝您抽出時間回覆,我需要能夠設置它在臨時表中,因爲這將被傳遞給創建多標籤電子表格的程序。 – NinjaWfc

0

是否可以動態創建臨時表?如果是的話,你可以動態設置有

DEFINE VARIABLE ttDynTable AS HANDLE NO-UNDO. 
DEFINE VARIABLE vInt  AS INTEGER NO-UNDO INIT 77. 

CREATE TEMP-TABLE ttDyntable. 
ttDynTable:ADD-NEW-FIELD('dtoday', 'DATE', 0, "99/99/9999",?,"","dg " + STRING(vInt)). 
ttDynTable:TEMP-TABLE-PREPARE("tt-dg1"). 

ttTTHandle = ttDyntable:DEFAULT-BUFFER-HANDLE. 
ttTTHandle:BUFFER-CREATE. 
ttTTHandle::dtoday = TODAY. 

DISPLAY ttTTHandle:buffer-field('dtoday'):column-label ttTTHandle::dtoday. 

如果不是你可以拉列標籤從緩衝區,而不是

DEFINE TEMP-TABLE tt-dg1 FIELD dtoday AS DATE COLUMN-LABEL "dg ". 
DEFINE VARIABLE vTTHandle   AS HANDLE NO-UNDO. 
CREATE tt-dg1. 
dtoday = TODAY. 

vTTHandle = BUFFER tt-dg1:HANDLE. 
vTTHandle:BUFFER-FIELD("dtoday"):column-LABEL = vTTHandle:BUFFER-FIELD("dtoday"):column-LABEL + "77". 

DISPLAY vTTHandle:BUFFER-FIELD('dtoday'):COLUMN-LABEL.