有没有办法通过静态引用获取静态缓冲字段的名称?

huangapple go评论56阅读模式
英文:

Is there a way to get static buffer field's name by static reference?

问题

我知道有一种方法可以使用静态缓冲区的表名:

DEF BUFFER Customer_B1 FOR Customer.

DEF VAR cTableName AS CHAR NO-UNDO.

cTableName = BUFFER Customer_B1:HANDLE:TABLE.

是否有类似的方法可以通过静态引用获取缓冲区字段句柄和字段名?

我想使用静态缓冲区,因为它们在编译时针对配置的数据库进行了检查。这意味着如果某个表或字段丢失,代码将无法编译。 我不想使用字段编号或字符串名称来获取字段句柄。

英文:

I know there's way to get static buffer's table name with this:

DEF BUFFER Customer_B1 FOR Customer.

DEF VAR cTableName AS CHAR NO-UNDO.

cTableName = BUFFER Customer_B1:HANDLE:TABLE.

Is there a similar way to get buffer field handle and it's field name using static reference?

I would like to use static buffers because they are checked at compile time against the configured database. This means that if some table or field is missing, the codes won't compile. I wouldn't like to use field number or string names to get the field handle.

答案1

得分: 3

不是以静态方式(例如,使用字段名称的编译时检查)。

ASSIGN cName     = BUFFER Customer_B1:BUFFER-FIELD ("CustNum"):NAME
       cDataType = BUFFER Customer_B1:BUFFER-FIELD ("CustNum"):DATA-TYPE .

顺便说一下,在您上面的示例中,您可以省略 :HANDLE 部分:

cTableName = BUFFER Customer_B1:TABLE.
英文:

Not in a static way (e.g. with compile time check for the field name).

ASSIGN cName     = BUFFER Customer_B1:BUFFER-FIELD ("CustNum"):NAME
       cDataType = BUFFER Customer_B1:BUFFER-FIELD ("CustNum"):DATA-TYPE .

By the way, in your sample above, you can leave out the :HANDLE bit:

cTableName = BUFFER Customer_B1:TABLE.

huangapple
  • 本文由 发表于 2023年6月26日 15:48:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76554586.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定