Populating Gross weight of an Item

Hi Friends,

i have added a field in purchline table i.e “GrossWeight”. I need to populate data into this field from inventable

When ever i select a item no in the purcline fields data populated automatically in price & Units Table. As well a i need to populate the Grossweight fileld from invent table.

i.e inventTable.NetWeight+inventTable.TaraWeight;

To achive this i wrote fallowing methods in purchline Table:


GrossWeight ItemgrossWeight(Itemid _itemid =this.ItemId)
{
InventTable inventTable;
;
if (_itemId)

select firstonly inventTable
index hint ItemIdx
where inventTable.ItemId == _itemId;

return inventTable.NetWeight + inventTable.TaraWeight;

}


And call the method from purchline modifiedfeld mehod:

case fieldnum(PurchLine, GrossWeight):
this.GrossWeight=this.ItemgrossWeight();
break;

But it not works…Any help.

No need of writing a seperate method .There exist already a find method in InventTable.

To fill a field automatically - you should not write a case for the same field. You should have written it for item Id field or some other field depending on the situation.

I believe that the system will pick up some values from InventTable by using initFromInventTable method in PurchLine.

Try by adding your code there. (like this.GrossWeight = _inventTable.NetWeight + _inventTable.TaraWeight);

Hi kranti,

Thank’s for your brief explanation. i wrote the code in the suggested method.

this.grossweight = inventTable.Grossweight;

Problem solved.