我正在寻找一种方法来从以下临时表定义中访问表
LABEL
值“客户信息”:
/* 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.
我试过上面的各种口味,想不出神奇的组合。
临时表本身没有标签,但各个字段都有。您可以像这样访问它们:
DISPLAY buffer ttCustomer:buffer-field( "custName" ):LABEL.
虽然文档不表示可以定义标签,但可以为临时表指定一个标签is在错误消息中使用。这提供了一个提取标签的开口:
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.
继 Stefan 的惊人想法之后,这是为原始问题(表格标签中有一个空格)实施的实际解决方案,并处理 Progress 的古代版本以及当前迭代:
def var msg as char.
def var tt 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.
msg = error-status:get-message(1).
/*
msg will be: ** Customer Information record not on file. (138)
*/
tt = substring(msg, 4, length(msg) - length('record not on file. (138)') - 4 ).
message tt.