英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论