Group Separator (GS) and Record Separator (RS) in barcode

1 Answer 349 Views
Expressions Report Designer (standalone)
Jorge
Top achievements
Rank 1
Iron
Jorge asked on 23 Jun 2023, 11:37 AM

Good afternoon, 

 

I'm trying to generate a barcode with GS and RS characters inside a barcode with no success (those are mandatory for GTL labels in VDA standard).

I've been trying to do Char(29), Chr(29), ChrW(29), (char)29, Convert.ToChar(29), ... but nothing worked me.

 

Best regards

Dimitar
Telerik team
commented on 28 Jun 2023, 09:12 AM

Hello Jorge,

I was able to generate a barcode with those characters using the Barcode Report Item and the default encoder - Code128.

May I ask which encoder are you using? Also, what kind of issues have you met, are there errors when you preview the barcode? If yes, could you please share the error message? Would you send me a sample report with the problem?

Please keep in mind that it is possible to render even barcodes that we do not support out of the box by using the approach from the Generate unsupported Barcodes - Telerik Reporting KB article.

Jorge
Top achievements
Rank 1
Iron
commented on 28 Jun 2023, 10:30 AM

Hello Dimitar, 

 

If I use some of the following code in the Value property.

="[)>" + \u000029 + "06" + \u000030 + "PABCDEFGHI" + \u000030 + "Q30"

or 

="[)>" + GS + "06" + RS+ "PABCDEFGHI" + RS + "Q30"

or 

="[)>" + Convert.ToChar(29) + "06" + Convert.ToChar(30) + "PABCDEFGHI" + Convert.ToChar(30) + "Q30"

If using Datamatrix, the barcode is not displed. When using PDF417, the barcode is displayed but it's not readable.

---

I recieve the error The expression contains invalid hexadecimal number: 29 + "06" +'. if I try to show it like this.

="[)>" + 0x29 + "06" + 0x30 + "PABCDEFGHI" + 0x30+ "Q30"

---

I receive the error Cannot interpret token '$' at position 9. if I try to show it like this. (If I remove the $, appears the plain text, not the code)

="[)>" + $"{0x29}" + "06" + $"{0x30}" + "PABCDEFGHI" + $"{0x30}" + "Q30"

---

I receive the error Missing operator before '29' operand.

="[)>" + (char)29 + "06" + (char)30 + "PABCDEFGHI" + (char)30 + "Q30"

Dimitar
Telerik team
commented on 03 Jul 2023, 06:46 AM

Hello Jorge,

I suggest using a custom function to produce the string for the barcode with all the necessary characters, for example:

        public static string BarcodeString()
        {
            char rs = Convert.ToChar(30);
            char gs = Convert.ToChar(29);
            char eot = Convert.ToChar(4);
            return "[)>" + rs + "06" + gs + "17V98897" + gs + "1P4L0014-163B" + gs + "SSA10197" + rs + eot;
        }

I tested this string with both PDF417 and DataMatrix encoders, and it worked as expected. For guidance on how to use custom functions in reports, please refer to the Custom User Functions Explained - Telerik Reporting article.

I hope this workaround will help.

1 Answer, 1 is accepted

Sort by
0
Accepted
Jorge
Top achievements
Rank 1
Iron
answered on 05 Jul 2023, 07:30 AM

Hello Dimitar, 

 

Thank you for your help, but I think that it's only possible if you have the reports inside the project, and in my case, I use Telerik Report Designer (the standalone application), this is why I was trying to do it directly through Expressions and using JSON Datasource.

 

Nevertheless, taking your idea, I've tried it sending the special characters as JSON Data, and it worked! I've used this code (perhaps it can help someone else):

JSON Data:

{
    "Position": "A1-B3",
    "GS": "\u001D",
    "RS": "\u001E",
    "Article": "ABCD EFGH",
    "Quantity": 10
}

And the Expression Formula:

="[)>" + Fields.GS + "06" + Fields.RS + "PABCDEFGHI" + Fields.RS + "Q30"

 

Thank you so much for your help!

 

Tags
Expressions Report Designer (standalone)
Asked by
Jorge
Top achievements
Rank 1
Iron
Answers by
Jorge
Top achievements
Rank 1
Iron
Share this question
or