Official Content

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


The ScanBarCode method returns a VarChar(200).

Step 1

In this example you will use the following Transaction object:


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:



Step 4

Add the following behavior to the "Scan Now!" event: 

Event 'Scan Now!'
         &VarCode = Scanner.ScanBarcode()
         Proc(&varCode, ProductId)

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             

Done. When scanning a code, a Procedure will be called to store the number in the ProductNumber attribute.

Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant