You have mixed up barcode printing and barcode data entry.
When printing you need to process your item id into a string suitable for the barcode font.
This is what the barcodeStr
method do.
On entry you need a scanner. The scanner gives you your item id, as if you have entered it your self. Thus no further processing of the barcode is needed. The scanner takes care of that.
Provided you have an ItemId
field in your table, create a display method for that table:
display ItemNameAlias nameAlias()
{
return InventTable::find(this.ItemId).NameAlias;
}
Do not copy the method to the form, but reference it from the form as described here.
In your form you will have two controls, ItemId
bound to your field and nameAlias
refering to your display method.