This tutorial is a guide for using the ScanBarcode method offered by the Scanner external object.
The ScanBarCode method returns a VarChar(200).
In this example you will use the following Transaction object:
Apply the Work With Pattern to it.
Go to the Section (General) node located under the Detail node. From the Layout tab, right-click on the Application Bar and insert a button as follows:
Add the following behavior to the "Scan Now!" event:
Event 'Scan Now!'
Composite
&VarCode = Scanner.ScanBarcode()
Proc(&varCode, ProductId)
EndComposite
EndEvent
The &VarCode definition is:
The ScanBarcode method returns the value scanned. This value is returned in a VarChar(200)
After scanning the barcode you will want to use that value.
Therefore, you can call a Procedure object that uses that information. (This is one way to use the information obtained, there are many ways to use it).
Suppose the called Procedure contains the following Parm rule:
parm(&varCode, ProductId);
And its Source contains the following code:
For Each Product
where ProductId = &ProductId
ProductNumber = &varCode
EndFor
Done. When scanning a code, a Procedure will be called to store the number in the ProductNumber attribute.