Hi,
I have spent close to 20 hours trying to solve what I thought would be 5 seconds of coding, alas I have had little success. I have read tutorials, Microsoft guidance, YouTube videos, etc. and still not figured out how to do this and am at whits end.
GOAL: I want to use my scanner to scan a QR code to input Items into the Production BOM (specifically Lines) area. Essentially, if I select the ItemNo, I want the ItemReferenceNo to be populated (along with description), and vice-versa, if I scan a QR code (corresponding to an item) I want the ItemNo and Description to be populated - the purposes is to, rather than using a keyboard, be able to use my scanner to input items. I plan to replicate this in other areas as well, but...one project at a time. There are no issues with the scanning itself, which works properly on certain other pages.
CURRENTLY: I have created a column /ItemReferenceNo/ that corresponds to an Item's Reference Number (Barcode) in a TableExtension object. This table extends /Production BOM Line/. The field properly shows (created simple PageExtension as well which seems to work fine) on the Page and Table. HOWEVER, the Item Reference Number is NOT being input when the Item Number is entered. On the opposite, if I input the Item Reference Number by scanning, the Item Description and Item Number fields will not populate. Below excerpts are the relevant code I've used.
Apologies, apparently the forum is not allowing me to post photos. I am including the Code excerpt below.
Attch 1: TableExtension 50104 extends /Production BOM Line/ [Tbl 99000772]
tableextension 50104 BOMTableExtension extends /Production BOM Line/
{
fields
{
field(50104; ItemReferenceNo; Code[50])
{
Caption = 'Item Reference No';
DataClassification = CustomerContent;
TableRelation = IF (Type = const(Item)) /Item Reference/./Reference No./;
trigger OnValidate()
var
Item : Record Item;
ItemReference : Record /Item Reference/;
begin
ItemReference.Get(ItemReferenceNo);
/No./ := ItemReference./Item No./;
Description := Item.Description;
end;
}
modify(/No./)
{
trigger OnAfterValidate()
var
ItemRef : Record /Item Reference/;
begin
ItemReferenceNo := ItemRef./Reference No./
end;
}
Attch 2: PageExtension 50104 extends /Production BOM Line/ [ListPart 99000788]
pageextension 50104 PageExtension50104 extends /Production BOM Lines/
{
layout
{
addafter(/No./)
{
field(ItemReferenceNo; Rec.ItemReferenceNo)
{
ApplicationArea = All;
Editable = true;
}
}
}
}