HowTo: Using ScanBarcode Method from Interop in SDApi for Smart Devices

Official Content
This documentation is valid for:

Warning: Deprecated since GeneXus X Evolution 2 Upgrade 3. Use the ScannerAPI external object (X Evolution 3) instead.

This article is a short guide to show how to configure and use this method.

In this example we will use the following Transaction object, with the Work With for Smart Devices object (WWSD) applied:

sbcTrnProduct

As you can see the ScanBarCode method returns a  variable of VarChar(200). The name of the variable is ScanBarcode.

sbcInterop

Add the action to de WWSD:

sbcImageProperties

After scanning the barcode we want to use that value.

We can call a Procedure object in a composite action which uses that information. (This is one way to use the information obtained, there are many ways to use it).

The procedure we are going to use is the following:

For Each
       where ProductId = &ProductId
       ProductNumber = &ScanBarcode
EndFor

And the following rules:

parm(&ProductId, &ScanBarcode);

We have to make a composite action that will first scan the barcode, get the value scanned, and send it to a procedure to use that value.

The ScanBarcode method returns the value scanned. This value is return in a VarChar(200), so we have to have a variable in our WWSD to save this value.

The variable is as shown bellow:

sbcTrnApplyPattern

The event with composite action:

Event 'ScanNow!'
    Composite
         &VarCode = Interop.ScanBarcode()
         Proc.Call(&varCode, ProductId)
    EndComposite
EndEvent

Done. When scanning a code it will call the procedure to save the number in the attribute ProductNumber of the Transaction.

Notes

  • In iOS this SDApi is available for iPhone, iPad2 and iPod with iOS 4.X
  • For Android it is needed to have the ScanBarcode app installed from the AppMarket.


Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.