How to Generate a GS1-128 Barcode in a Docentric Template/D365FO?

Hello Docentric,

We are currently working on a customer labeling project where we need to integrate the GS1-128 barcode format. We’ve successfully generated a string value for a specific data field and managed to display it as a Code128 barcode. However, our customer is insisting that our implementation is not compliant with the GS1-128 barcode format.

To address this concern, we’ve explored the Designer tool, but it seems that GS1-128 barcodes are not listed among the supported barcode symbologies.

I came across an article that explains how to use barcodes with Docentric, and it also mentions the possibility of implementing the GS1-128 barcode format through custom code. However, considering our time constraints, we are keen to find an alternative solution.

Is there a way to generate GS1-128 barcodes using Docentric without resorting to custom code? Your guidance and support would be greatly appreciated. Thank you!

Hello Julie,

Thank you for contacting Docentric support. We’ve tested the GS1-128 barcode requirement and found a simple and effective solution that doesn’t require any code customization :+1:

To meet the GS1-128 barcode specifications, you can modify your template/barcode tagging element by adding a prefix character 'ñ ’ (FNC1) in the binding expression.

Here’s an example of the XPath expression that does this:

concat(“ñ402”, BillOfLading/@BillOfLadingId)

In the expression above, we use the ‘ñ’ character as the prefix requested for the GS1-128 barcodes, followed by the number ‘402’, and then add the value of the @BillOfLadingId data field. This creates a GS1-128 barcode format (below, 1), as required.

The number following the prefix serves as an example of the Application Identifier.

Implement a GS1-128 Barcode in the Report Template

Here’s how to implement this solution in your Docentric template with only a few easy clicks:

  1. Apply the existing Code128 barcode symbology available in Docentric Designer (above, 2) for the specific Barcode tagging element.
  2. Apply the XPath expression provided using the concat function to add the ‘ñ’ prefix and the requested Application Identifier to the existing custom data field that contains the string you want to display as a GS1-128 barcode.

With this adjustment, you effectively transform a Code128 barcode into a GS1-128 barcode. Given the simplicity of this approach, we haven’t introduced a dedicated GS1-128 barcode symbology in Docentric Designer.

Test the GS1-128 Barcode

After generating a preview of your template, you can validate the generated barcode to ensure it complies with the GS1-128 standard using an online barcode reader.

If you have specific requirements or need further assistance, please provide your template and specify which barcodes should adhere to the GS1-128 standard. We can then help you fine-tune the XPath expression to meet your specific needs.

Here is my test template:
WHSBillOfLading.Report_with_GS1-128_barcode.docx (120.4 KB)

Generate a GS1-128 Barcode with multiple Application Identifiers (AI)

To create a GS1-128 barcode with multiple Application Identifiers (AI) like SSCC, container count, batch number, production date, and GTIN, an XPath expression for the Barcode tagging element needs to be provided to result in the correct input string.

For example, let’s consider the desired scanned barcode output string (below, 1): (02)18435083131973(11)231110(10)2230000512(37)630

To get the above output, we need to structure the corresponding input string (2) for the Barcode tagging element, which in this case, reads:
ñ0218435083131973ñ11231110ñ102230000512ñ37630

Here’s how to correctly format the GS1-128 barcode input string:

  1. Eliminate the brackets indicating an AI in the desired output string (below, 1).
  2. Insert the ñ prefix character before each AI in the same string (below, 2).

Scanning the resulting barcode above accurately recognizes the Application Identifiers preceded by the prefix character, ensuring the correct interpretation of the barcode content, identifiers, and GS1 barcode format.

While the above example illustrates a simple approach, more complex input string scenarios can be addressed using the advanced XPath functions. For example:

  • Concatenating various data fields into a unified string using the concat function.
  • Specific date formatting (YYMMDD) for adding dates to the GS1 barcode, ensuring compliance with the GS1-128 date format using the format function.

Test template: GS-128-barcode-with-multiple-AIs.docx (101.3 KB)

We are creating a GS1-128 template which requires four Application Identifiers in one barcode. We are able to use the concat function to get the data in the barcode but we cannot get it to work when we also try to format that date to be in the proper format nor can we get the quantity to be a whole number with no decimals. Can you help?
DocWHSLicense_Fujicode.Report_Docentric.docx (48.5 KB)
DocWHSLicensePlateLabel.Report.ddsp (105.5 KB)

Hi @tandrisani ,

First of all welcome to Docentric community!

I did some testing and managed to get the working barcode using this expression:

concat("ñ01", @ExternalItemText, "ñ17", format(@BatchExpirationDate, 'yyMMdd'), "ñ30", format(@Qty, '###'), "ñ10", @InventBatchId)

Can you try it on your side, test it, and let me know if it works?

Thank you! This helped but in the event that there is no expiration date on the item, the label will not render. Can you assist?
DocWHSLicensePlateLabel.Report (1).ddsp (105.1 KB)

Hi @tandrisani ,

I was able to generate the label in PDF without any issue using the supplied ddsp. Are you on the latest version of our Docentric AX designer for MS Word add-in? My version is 6.1.53.1699

Here is the template with the updated concat statement and a ddsp without an expiration date. I appreciate the assistance.

DocWHSLicensePlateLabel.Report (1).ddsp (105.1 KB)
DocWHSLicense_Fujicode.Report_TCAv1.docx (48.5 KB)

Hi @tandrisani,

I did some additional testing, and it seems that the value expected for the Qty data field should have at least two digits. This wasn’t the case with the latest DDSP file, which caused an error. So, I modified the Xpath expression and added a condition to make sure that if the quantity is less than 10, it always returns two digits (like 01, 02, 03).

Here is the new XPath expression:

iif(@Qty < 10,
(concat("ñ01", @ExternalItemText, "ñ17", format(@BatchExpirationDate, 'yyMMdd'), "ñ30", format(@Qty, '00'), "ñ10", @InventBatchId)),
concat("ñ01", @ExternalItemText, "ñ17", format(@BatchExpirationDate, 'yyMMdd'), "ñ30", format(@Qty, '###'), "ñ10", @InventBatchId)
)

Could you run any necessary tests and let me know the results?

This is working great for smaller quantities but when I try to print this label for 20,000 it won’t render.
DocWHSLicensePlateLabel.Report.ddsp (107.9 KB)

Hi @tandrisani,

The only way I could get this to work was by placing the quantity at the end of the string.

concat("ñ01", @ExternalItemText, "ñ17", format(@BatchExpirationDate, 'yyMMdd'), "ñ10", @InventBatchId, "ñ30", format(@Qty, '###'))

Would this solution also work for you?