First of all declare a record variable for the Item table
Add a textbox from the toolbox. Add into the source property Item.Inventory (I assume this is the field you want). Then add the C/AL code in the onaftergetrecord
if not item.get(“no.”) then
item.init
else
item.calcfields( Inventory );
You might have to add to the onaftergetcurrrecord as well.