Barcode converter - Regular Expressions
- Johannes Sebastian Nielsen
- Morten Bjørn Larsen
- Maria Jose Avila
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.
- Configured using "start.cfg" Scanner Configuration
Searching order lines
When you want to search Order Lines page by barcode.
- Configured using "Application.cfg" Mobile Configuration Files
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 | Expression | Description | Value examples |
---|---|---|---|---|
Simple Code39 | Quantity AI 37 | ^(\d{1,4})$ | Only from 1 to 4 digits | 1,11, 111 or 1111 |
EAN13 numbers | Item AI 91 | ^(\d{13})$ | Only exactly 13-digits | 1234567890123 |
Any string | SN AI 21 | ^(\w{1})+$ | Any alfa-numering string | abc123.. |
-
-
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
... <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.
... <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.
<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
- Regular expression: ^(\d{1,6})(\d{1,5})$
- Test string: 11111122222
See also
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
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
Entity | Application Identifiers |
---|---|
Item | 01, 02 and 91 |
Bin | 00 |
Lot | 10 |
Serial | 21 |
Expiration Date | 12, 15 and 17 |
Quantity | 30, 37 and 310 |
Package No. | 92 |
License Plate | 98 |
Tote (Legacy) | 98 |