Official Content

This tutorial is a guide for using the ScanBarcode method offered by the Scanner external object.

image_2023529141443_1_png

The ScanBarCode method returns a VarChar(200).

Step 1

In this example you will use the following Transaction object:

sbcTrnProduct

Step 2

Apply the Work With Pattern to it.

Step 3

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:

image_2023529153527_1_png

 

Step 4

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:

sbcTrnApplyPattern

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.



Last update: April 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant