我正在寻找一种方法来访问表LABEL
值"客户信息"来自下面的temp-table定义:
/* Define the temp-table */
DEFINE TEMP-TABLE ttCustomer LABEL "Customer Information"
FIELD CustNum AS INTEGER
FIELD CustName AS CHARACTER
FIELD CustCity AS CHARACTER.
/* Access the label attribute */
DISPLAY ttCustomer:LABEL.
我试过以上各种口味,都没能找到最神奇的组合。
虽然文档没有指出可以定义标签,但是可以给临时表一个标签,其中是在错误消息中使用。它为提取标签提供了一个开端:
define temp-table tt label 'ttbar'
field ii as int
.
find tt where false.
catch e as progress.lang.error:
message entry( 2, e:getMessage(1), ' ' ).
end catch.
temp-table本身没有LABEL,但是各个字段有。您可以像这样访问它们:
DISPLAY buffer ttCustomer:buffer-field( "custName" ):LABEL.
遵循Stefan的惊人想法,这是针对原始问题(在表标签中有一个空格)实现的实际解决方案,并在Progress的古代版本以及当前迭代中工作:
def var err as char.
DEFINE TEMP-TABLE ttCustomer LABEL "Customer Information"
FIELD CustNum AS INTEGER
FIELD CustName AS CHARACTER
FIELD CustCity AS CHARACTER.
find ttCustomer where false no-error.
/* ** [tt label or name] record not on file. (138) */
err = substring(error-status:get-message(1), 4).
message substring(err, 1, length(err) - length(' record not on file. (138)')).