Barcode reader

The 'Barcode reader' behaviour allows one or more barcodes to be read and processed by a connected camera.

It is possible to limit the number of barcodes read, as well as specifying a text filter that excludes certain contents of barcodes.

NOTE◄ The user must allow the use of the camera both in the browser and in the security settings of the operating system!

After the Behaviour type 'Barcode reader' has been selected (1), it can be configured as follows:

images/download/attachments/78253926/bcr-bv-version-1-modificationdate-1627987346649-api-v2.png

(2) Types of barcodes: Here you can limit the barcode types to be read. If no barcode types are selected, all will be recognized.

►NOTE◄ The fewer types defined, the better the recognition performance.

(3) Minimum number of barcodes: Here the minimum number (of barcodes to be read) can be determined. This can be done directly or with a Berechnungsausdruck. This number and the number of barcodes already read are displayed in the camera image for orientation purposes.

(4) Maximum number of barcodes: Similar to above, here the maximum number of barcodes can be determined. If only one barcode can be read by the setting options 3 and 4 (e.g. min = 0, max = 1), a single object is returned as the result, otherwise a list of objects is returned.

(5) Text-blacklist: With the help of this Berechnungsausdruck, a list of barcode values can be blocked, which can then no longer be scanned by the user. The expression can thereby provide exactly one value or a list of values.

Tip: A simple list can be created with the function notEmptyFilter, as seen in the example above.
An example of static values would be: '$notEmptyFilter(706487017615,00056767668)'. Here the barcodes with the values 5706991 and 00056767668 would be ignored during the scanning process.

(6) Close automatically: If activated, the camera window will be closed automatically as soon as the maximum number specified (in this case 4) is reached.

(7) Allow duplicates: This switch allows duplicate values to be read.


If the behaviour is executed, then the image of the camera can be seen.

images/download/attachments/78253926/barcode-video-version-1-modificationdate-1627987346664-api-v2.png

(1) The barcode reader is terminated here. The icon changes its color and shape as soon as a permissible number of barcodes has been accepted.

(2) Barcodes that have already been read can be viewed here and deleted if necessary, or their order can be changed via drag & drop.

(3) The camera can be selected here. If no camera has been selected yet, the first camera found will be displayed. The selected camera is saved locally (in the user's browser), provided that cookies are permitted.

(4) If a barcode was detected, it can be confirmed by clicking the button.

(5) If a barcode was detected, it can be discarded by clicking the button.

(6) Barcodes that are found are indicated by a green mark. This can help to confirm or reject the desired code in case of several visible barcodes.

Return

As can be seen in the top image, barcodes can be further processed by actions. If the user can only read a single barcode (due to the min/max number settings) the following structure is returned:

{
text: "barcode text",
format: "barcode format"
}


If more than one barcode is read, a list from the above structure is returned:

[
{
text: "barcode text 1",
format: "barcode format 1"
},
{
text: "barcode text 2",
format: "barcode format 2"
},
{
text: "barcode text 3",
format: "barcode format 3"
}
]

If the barcode reader is terminated without a permissible number of barcodes having been read, the actions on 'false' are triggered.