0

When editing bill of material (BOM) lines, the value of field "Quantity" should be copied to field "Height". How can this be achieved?

See also the following two pictures:

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

FH-Inway
  • 4,432
  • 1
  • 20
  • 37
Mechri
  • 17
  • 1
  • 3

1 Answers1

1

Table you are looking for is called BOM.

"Quantity" field is called BOMQty.

"Height" field is called dim1.

Both BOMQty and dim1 are of type real, so there should not be any real issues initializing the values. The main question is WHEN do you need to initialize "Height" field. For learning purposes, try playing with this code:

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

For just updating the field once, I would suggest using update_recordset

For initializing the height upon line creation, add this line to BOM.insert() method, before calling super():

this.dim1 = this.BOMQty;
Maxim Lazarev
  • 1,254
  • 12
  • 21
  • Thank you Maxim for your reply I want initialize "Height" field when the user adds a new line in BOM when it inserts the quantity (for example 0.5) this quantity will be put into "Height" field – Mechri Mar 11 '15 at 06:54
  • Just add this line to `BOM.insert()` method before calling `super()`: `this.dim1 = this.BOMQty;` – Maxim Lazarev Mar 11 '15 at 07:12
  • 2
    Also, consider using `modifiedField` of BOM, as the use will see the height change immediately. – Jan B. Kjeldsen Mar 11 '15 at 07:50