KB-31856: Application login via barcode.

Question:

How can I log in to an application with a barcode?

Solution:

To do so, follow these procedures:

  • First, make sure you have the device (barcode) set up and working properly;
  • Then, use a database to create a table with at least three columns: login, password, and code;
  • Create the same users from Studio;
  • Create a query filtering per read code and returning the corresponding user;
  • Retrieve these values (login and password) with GetADORecordSet() method, and send them to LoginUser() method. This will allow the user to log in directly, without having to type login and password. Alternatively, you can use PasswordConfirm(True) method.

The resulting script will be similar to this:
(replace “Text9.Value” with the tag related to the read code)

dim Username, UserPassword
set query = Screen.Item(“QueryF”)
query.SetVariableValue “CodeRead”, Screen.Item(“Text9”).Value
set filter = query.GetADORecordset()
if filter.RecordCount > 0 then
 Username =  filter.Fields(“Login”).Value
 UserPassword = filter.Fields(“Password”).Value
 Application.LoginUser Username, UserPassword
 if Application.PasswordConfirm(True) = False then
  MsgBox “Incorrect Password!”
 End If

else
 MsgBox “Error when reading code!”
End if

The sample application attached to this article has been developed with E3 v3.1, build 285.

Attachments:

BarCode-en.zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *