Barcode converter - Regular Expressions

Description

The Mobile app can convert custom barcodes into the recommended Encoded Barcode (GS1)

Use case

You should use always use or print GS1 barcodes See Best Practice: Labeling Items.

However, some times this is not possible and other types like simple barcodes, must be scanned.

Use converters to capture, identity and convert barcodes to GS1 AI's.

Global usage (Most commonly used)

When you want custom barcodes to be handled in the entire app.

Searching order lines

When you want to search Order Lines page by barcode.

Converter Examples

Converter expressions are wriiten as Regular Expressions.

Tip: To make sure no partial matces are made, use capture groups "()" and also "$" to end the expression.

Convert from

Convert to

ExpressionDescriptionValue examples
Simple Code39Quantity AI 37
^(\d{1,4})$
Only from 1 to 4 digits1,11, 111 or 1111
EAN13 numbersItem AI 91
^(\d{13})$
Only exactly 13-digits 1234567890123
Any stringSN AI 21^(\w{1})+$Any alfa-numering stringabc123..

-

- 

Example 1: A very custom barcode converted into four AI's

Different positions of a barcode, is broken into diffent AI's.

  • expression: The regular expression
  • expressionAis: The order in which the different capture groups into AI's

Change in Start.cfg
...
<scanner>
  <type>internal</type>
    <converter enabled="true" type="custom2gs1">
      <customConfiguration expression="^64(\w{1,8})(\d{1,4})(\d{1,3})(\w{1,10})$" expressionAis="10,37,92,91"/>
    </converter>
...

Mapping table 

AI

Position

Length

Description


1

2

A fixed value that is always "64"

AI 10

3

8

External Order No.

AI 37

11

4

Quantity

AI 92

15

3

Quantity per Unit of Measure

AI 91

18

10

SupplyID (Internal item)


Example 2: GS1 barcode converted to GS1

convertGS1Input: Should be set to true if one wishes to convert from a GS1 barcode to GS1.

This could be in cases when the barcode scanned contains AIs that are not supported and when printing a new label is not an option.

Change in Start.cfg
... 
 <scanner>
    <type>internal</type>
    <converter enabled="true" type="custom2gs1" >
      <customConfiguration expression="^01(\d{14})11(\d{6})21(.{1,})$" expressionAis="91,10,21" convertGS1Input="true"/>
 </converter>
...


Example 3: Long item numbers as Code39 - converted to GS1 Item on Receive Lines

Since AI91 is already regarded as "Item No." but without the length constraint of AI01,

This can be used for many 1D (linear) barcodes like Code39 or Code128.

In this example the data is 20 char, but can be arbritary length since AI91 allows for this.


Change in Application.cfg
<page id="ReceiveLines" type="OrderLines" icon="mainmenureceive">
  <title defaultValue="@{PageReceiveOrderLinesTitle}"/>
  <orderLinesConfiguration suggestQuantity="true" verifySingleScanRegistrations="false" actionOnEmptyList="ClosePage">
    <service id="Receive"/>
    <list listId="OrderLines"/>
    <...>
    <scanToSelectBehaviour gs1SearchTerm="Item" behaviour="Auto">
      <converter expression="^(\d{1,20})$" expressionAis="91"/>
    </scanToSelectBehaviour>
  </orderLinesConfiguration> 


Error message

Invalid barcode format Barcode format error 'Invalid length'. The scanned value was 'xyz'

This can be the result of using AI01 which defines a fixed length of 14 char.

Use AI91 instead.


Online Editor

Use an online editor to test your regular expressions.

Example

https://regex101.com/ 

  • Regular expression: ^(\d{1,6})(\d{1,5})$
  • Test string: 11111122222








See also

Encoded barcodes

Encoded barcodes like GS1 Datamatrix has data in two dimensions,
unlike simple 1d barcodes like Code128



Default AI support

Mobile WMS will accepts these AI's as standard

EntityApplication Identifiers
Item01, 02 and 91
Bin00
Lot10
Serial21
Expiration Date12, 15 and 17
Quantity30, 37 and 310
Package No.92
License Plate98
Tote (Legacy)98