Barcode Scanner Input data n d Enter

I am trying to use 2D Barcode scanner to scan the downtime reason on the floor. I have a tab container and in one of the tab, I have a embedded view that has the barcode BarcodeInput component.
no matter what I scan I get below response on the screen

I tried directly on the perspective page without the embedded component and still I see the same behavior.
Any suggestions ?

What regex/pattern matching(if any) is applied to the barcode input component? Show a screenshot of the component properties if you can.

What model of scanner are you using? What is the output of that scanner configured for? (Prefix, suffix, termination character?) What is the content of the barcode you are scanning supposed to be?


There is no specific pattern, I was looking to scan numbers and alphanumeric values to store to a memory tag.
This is the datalogic scanner we have, I don't know how it was set up

Open notepad (or notepad++, if you have it) on the device connected to the scanner. Create a new text file or tab, and make sure your cursor is on an empty line and scan something using the scanner. It should write to the line in notepad, and you should be able to see the general output format of the scanner.

If that doesn't work, you'll need to connect to the scanner using their config software and see how it is configured, and use that to configure Ignition to look for the same things to properly parse the data.

@ryan.white, I created two barcodes using this site Free Online Barcode Generator: Create Barcodes for Free!

1. number 100 
2. text "Not Scheduled"

I tried scanning in excel and in notepad and I got 100 & "Not Scheduled" text.
Just to confirm, I did scan many times and every single time I got the correct value through the scan.

Looking through the documentation and based on the results you got, the scanner is running with no prefix and a carriage return as the suffix.

Trying setting the barcode scanner input component's suffix value to \r

1 Like

The regex pattern is applied to the buffer on every keypress, which makes it rather finicky. When you scan a barcode nd, the scanner will send a keypress n then a keypress d and finally a keypress Enter.

You're lucky though, because your scanner also sends a literal Enter after the input, so you can look for that. A regex like this might work:

^([A-Za-z0-9\-\/ ]+)(?:\n|\r\n|Enter)$

which should allow any alphanumeric characters, dashes, forward slashes and spaces. Add other characters as required.

1 Like

@VinceV you are the Man.

Thank you so much for your help

Be aware that using a "catch all" regex for your barcode scanner component will basically break any other text input field you place on the page. If you want reliable barcode scanning while also allowing other input, you should configure your scanner to emit a non-typable prefix and suffix.

2 Likes

^~([A-Za-z0-9\-\/ ]+)(?:\n|\r\n|)~$ something like this you mean ?
or
^~([A-Za-z0-9\-\/ ]+)(?:\n|\r\n|Enter)~$

Prefix and suffix should be different, and would typically be control codes (hard to accidentally type).

Control codes are all in the first column.


ASCII table. Image source: commfront.com.

STX and ETX look like good choices.

2 Likes

Extremely commonly chosen for this kind of thing.

BarcodeScannerInput is not working right at all.
I tried adding a Input TextField in perspective and It is matching the scan. for example 8400 in the Text field shows as 8400 however the same scan in BarcodeScannerInput object for a brief moment is flashes as 8400 vertically like

8
4
0
0

and only 0 stays. Same behavior after changing the captureMode and Regex = (.*)

The regex setting that @VinceV gave does not work after removing the Return carriage behavior by scanning the scancode given by the Datalogic support team to capture .

In both Regex setting it is capturing all the keys from the keyboard of the laptop as well.

Here is my setup

Your behavior is as expected since you lack a distinct prefix and suffix. You must reconfigure your scanner.