---
title: "Barcode Event"
id: "barcode-event"
project: "MES User Manual"
url: "https://docs.sepasoft.com/articles/user-manual/barcode-event"
updated: 2026-07-31T14:54:58Z
---

# Barcode Event

**Sepasoft MES Module Suite**

###  BarcodeEvent Object

The BarcodeEvent object contains the decoded results of a barcode. It is passed in the onBarcodeReceived event of the [BarcodeScanner](/articles/user-manual/barcodescanner) component and the [system.barcode.scanner.decode](/articles/user-manual/system-barcode-scanner-decode) script function.

### Object Functions

gs1ConvertToDate(value)
Description

This is helper function to convert a GS1 formatted barcode date to a date object.

Syntax

**gs1ConvertToDate(value)**

* Parameters

[String](/articles/user-manual/Data-Types-and-Formats) value - String value in the format of “YYMMDD”

* Returns

The resultant date object.

* Scope

All
 
gs1ConvertToDouble(value, decimalPlace)
Description

This is a helper function to convert a GS1numeric value to a double with the correct decimal place.
  
Syntax

**gs1ConvertToDouble(value, decimalPlace)**
 
****

* Parameters

[String](/articles/user-manual/Data-Types-and-Formats) value - String that represents the number to be converted to a double.
 
[String](/articles/user-manual/Data-Types-and-Formats) decimalPlace - String that represents the place in the value parameter to place the decimal place.

* Returns

The resultant double value.

* Scope

All
 
gs1ConvertToFloat(value, decimalPlace)
Description

This is a helper function to convert a GS1numeric value to a float with the correct decimal place.
  
Syntax

**gs1ConvertToFloat(value, decimalPlace)**
 
****

* Parameters

[String](/articles/user-manual/Data-Types-and-Formats) value - String that represents the number to be converted to a float.
 
[String](/articles/user-manual/Data-Types-and-Formats) decimalPlace - String that represents the place in the value parameter to place the decimal place.

* Returns

The resultant float value.

* Scope

All
 
### Properties

getErrorMessage()
Description

Returns the error message from the decoding process.
  
Syntax
 
**getErrorMessage()**

* Parameters

None

* Returns

Error message from the decoding process.

* Scope

All
 
getRawBarcode()
Description

Get the raw barcode as a string.
  
Syntax
 
**getRawBarcode()**

* Parameters

None

* Returns

The raw barcode.

* Scope

All
 
getResults()
Description

Returns a java hash table of the decoded results. The hash table has entries that have a key and a value. The key is defined in the configuration patterns and the value is itself a list of values returned from the Regex search.
 
For example, the pre configured GS1 pattern GTIN that has a key of “GS1-01” and a Regex pattern of “(01)(\d{14})”. When this pattern is found in the raw barcode, then an entry will be put into the match results with a key of “GS1-01” and the value will be a list of strings with 2 elements. The list of value strings is variable and is defined by the Regex pattern's grouping. In this case the first [0] element is “01” and the second [1] element contains the 14 digit GTIN number.
  
Syntax

**getResults()**
 
****

* Parameters

None

* Returns

A hash table of the decoded results.

* Scope

All
 
getUnmatched()
Description

Get the string of unmatched raw barcode after the decode method was called.
  
Syntax

**getUnmatched()**
 
****

* Parameters

None

* Returns

The unmatched raw barcode after the decode method was called.

* Scope

All
 
hasErrorMessage()
Description

Returns true if there is an error message passed with this event.
  
Syntax

**hasErrorMessage()**

* Parameters

None

* Returns

True, if there is an error message passed with this event.

* Scope

All
 
hasResults()
Description

Returns true if there is decoded barcode results that matched the patterns given.
  
Syntax

**hasResults()**
 
****

* Parameters

None

* Returns

True, if there is decoded barcode results that matched the patterns given.

* Scope

All
 
hasUnmatched()
Description

Returns true if there is an unmatched portion of the raw barcode after the decode method was called.
  
Syntax

**hasUnmatched()**
 
****

* Parameters

None

* Returns

True, if there is an unmatched portion of the raw barcode after the decode method was called.

* Scope

All
 
toDict()
Description

Returns the same results that getResults() but converted to python dictionary object with a string key and the value as an array of strings.
  
Syntax
 
**toDict()**

* Parameters

None

* Returns

A Python dictionary object containing the decoded results.

* Scope

All
 
**Sepasoft MES Module Suite**