如何在输入数据时将material 行帐单中"Quantity" 字段的值复制到"Height" 字段?

How can the value of the "Quantity" field in bill of material lines be copied to the field "Height" during data entry?

编辑 material(BOM)行的清单时,应将字段 "Quantity" 的值复制到字段 "Height"。如何实现?

另见下面两张图:

http://www.hostingpics.net/viewer.php?id=205252BOM1.jpg http://www.hostingpics.net/viewer.php?id=282509BOM2.jpg

Table 你要找的是BOM.

"Quantity" 字段被称为 BOMQty.

"Height" 字段被称为 dim1.

BOMQtydim1 都是 real 类型,因此初始化值应该没有任何实际问题。主要问题是 WHEN 是否需要初始化 "Height" 字段。 出于学习目的,请尝试使用此代码:

BOM BOM; //Table buffer
ttsBegin;
while select forUpdate BOM
{
    BOM.dim1 = BOM.BOMQty;
    BOM.update();       
}
ttsCommit;

如果只更新一次字段,我建议使用 update_recordset

为了在创建线条时初始化高度,将此行添加到 BOM.insert() 方法,然后调用 super():

this.dim1 = this.BOMQty;