As documented in the GS1-128 barcode object documentation, a set of Code-128 identifiers known as Application Identifiers (AI) are used to build the GS1-128 code.
For more information on this, please see the GS1-128 barcode object documentation.
However, in special situations where the GS1-128 code should be built based on Application Identifiers (AI) of variable length, you could get an invalid GS1-128 barcode.
Please check the following example of how to resolve this.
Let's say we have a GS1-128 barcode where we tried to use the following expression:
(02)[Item.GTIN](37)[OrderLine.Count](15)[OrderLine.BestBefore](10)[OrderLine.LotNo]
Then we may get an invalid barcode when the [OrderLine.Count] column that is used as the (37) Application Identifier (AI) is of variable length and its value is not the maximum possible length. The maximum possible length for a (37) AI is 8, as described in the GS1 reference.
To ensure you always get a valid barcode you can add a Group Separator Function Code (ASCII character 29) after the Application Identifier (AI) in question, so that you get an expression in the following format:
(02)[Item.GTIN](37)[OrderLine.Count][(string)IIf(StrLen([OrderLine.Count]) < 8, Chr(29), "")](15)[OrderLine.BestBefore](10)[OrderLine.LotNo]
In summary, adding the Group Separator Function Code is necessary when:
• It concerns a variable-length Application Identifier (AI) field
• The column value used for the Application Identifier (AI) in question is not the maximum possible length for the AI
• The AI is not the last AI in the barcode