# Scan barcodes from other systems

By default, ION expects a specific format for internally defined barcodes, but you can also scan barcodes from other systems with some basic configuration.

This can only be setup through the API currently. Let's use the below example to explain how to setup ION.

#### Example

In this example, you have an inventory barcode from another system that follows a pattern similar to a [GS1 barcode](https://www.gs1.org/standards/barcodes/databar).

That pattern looks like:

```
(01)<Part number>(17)(10)<Serial number>
```

ION uses [Regular expressions (RegEx)](https://en.wikipedia.org/wiki/Regular_expression), the standard for string pattern matching in software, to define the barcode pattern.

Converting this to a regular expression, the pattern for this example would be:

```
\(01\)(?P<part_partNumber>.*)\(17\)\(10\)(?P<serialNumber>.*)
```

This [RegEx website](https://regex101.com/) can be used for testing. The below snippet shows how you can validate your pattern with test barcode text.

Now that the pattern is defined, it's time to input it into ION. Use the GraphQL explorer in ION to add the pattern via the API.

<figure><img src="https://3615148728-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LkRqYp6lJhwxjYdzYG8%2Fuploads%2F3MH9CSOg99kzz2Y9Uuy3%2Fimage.png?alt=media&#x26;token=4f52feac-73c7-4fb7-9bad-df7af745f094" alt=""><figcaption></figcaption></figure>

**Note**: If you have included escape characters in your RegEx pattern, make sure to include a second `\` when inputting the expression into the API. These should show as double back slashes `\\`. This is necessary to meet JSON input requirements.

Here's the mutation in text if you'd like to copy from this example.

```
mutation CreateBarcodePattern($input: CreateBarcodePatternInput!) {
    createBarcodePattern(input: $input) {
        barcodePattern {
          id
          _etag
          entityType
          expression
        }
    }
}
```

```
{
  "input": {
    "entityType": "PARTS_INVENTORY",
    "expression": "\\(01\\)(?P<part_partNumber>.*)\\(17\\)\\(10\\)(?P<serialNumber>.*)"
  }
}
```

You can also use the below query to find all barcode templates that exist in your company's ION instance.

```
{
  barcodePatterns {
    edges {
      node {
        expression
        entityType
        id
        _etag
      }
    }
  }
}

```

After you execute the mutation, your company can scan barcodes from other systems and ION will find the correct corresponding object. To test out this functionality before implementing it in production, create test QR codes with a website like [Cognex](https://www.cognex.com/resources/interactive-tools/free-barcode-generator) or [QR-Code-Generator](https://www.qr-code-generator.com/).

Check out the below snippet that finds the appropriate inventory with part number `EX-PART-001` and serial number `1` from a scan.

<figure><img src="https://3615148728-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LkRqYp6lJhwxjYdzYG8%2Fuploads%2FB1R0nXbopipBlXFLTr9b%2F2022-11-14%2015.13.41.gif?alt=media&#x26;token=21ef2739-9b2b-46f4-bf59-7c5f4f97191a" alt=""><figcaption></figcaption></figure>

If the barcode scan is matched by multiple items in ION, the user will be presented with a list of options to choose from. Below shows a scan that matches 2 inventory items sharing the same part number/lot number combination.

<figure><img src="https://3615148728-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LkRqYp6lJhwxjYdzYG8%2Fuploads%2FS61DAcNFBaIbkywuotFD%2F2022-11-14%2015.22.39.gif?alt=media&#x26;token=520f125c-0a8f-4abe-b2ac-4f856ee74eaa" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.firstresonance.io/features/barcode-labels/scanning/scan-barcodes-from-other-systems.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
