Jump to content

Datamatrix Barcode 2 fields w/Tab Between


Eric Patrick

Recommended Posts

Posted

I'm setting up a Datamatrix barcode that has text information in field 1 "Sku" and then i want to it to horizontally tab to the next field "Qty" and populate that field with a number.

My coding is:

 

return MakeDataMatrixBarcode (Field("Sku") + ~0x09 + Field("Qty"), true, "TEXT", "6", "", "", "");

 

This gives me the barcode correctly but the tab doesn't work. Text "-10" is placed between the Sku data and the Qty data all in the first field.

 

I've tried using the coding from IDAutomation "~d009" but that just places "009" in between the other data. I have checked the scanner and it is setup for a US Keyboard.

 

What am I doing wrong?

 

Thanks!

Posted
return MakeDataMatrixBarcode (Field("Sku") + ~0x09 + Field("Qty"), true, "TEXT", "6", "", "", "");

That's not the right way to insert either a literal tilde or a tab character into a string in JavaScript. It's interpreting ~0x09 as the "bitwise not" operator followed by the number 9, which does result in the number -10, as you can see in the example here:

https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Operators/Bitwise_Operators#.7e_%28Bitwise_NOT%29

 

I think you want to do this, and turn the "process tilde" flag to false:

return MakeDataMatrixBarcode (Field("Sku") + [color=SeaGreen]"\t"[/color] + Field("Qty"), [color=SeaGreen]false[/color], "TEXT", "6", "", "", "");

Or, using the ASCII code for the tab character:

return MakeDataMatrixBarcode (Field("Sku") + [color=SeaGreen]Chr(9)[/color] + Field("Qty"), [color=SeaGreen]false[/color],  "TEXT", "6", "", "", "");

 

Actually, looking at the spec, I think you can just put the string "~d009" in there, like so:

return MakeDataMatrixBarcode (Field("Sku") + [color=SeaGreen]"[/color][color=#008000]~d009"[/color] + Field("Qty"), true,  "TEXT", "6",  "", "", "");

 

See the DataMatrix barcode spec:

http://www.idautomation.com/datamatrixfaq.html#Encoding_ASCII_Functions

Posted
Awesome Dan! Thanks for the help. The "\t" worked like a charm.

Great!

I tried the "~009" but it wouldn't work for me.

I think it will work if you use "~d009" (with a "d") and set the second parameter (use tilde) back to "true," as in the example on the IDAutomation site. But what you have is working, and seems simpler.

  • 4 weeks later...
Posted

Hello,

I need to do the same but using a linear barcode. I tried using 128 barcode and 39 barcode. Do you know if I need to download a specific font?

 

This is my rule:

return Make128BBarcode("03" + "~d009" + Field("numero"));

 

I also tried:

 

return Make128BBarcode("03" + "\t" + Field("numero"));

 

It ends up scanning symbols instead of the tab.

 

Regards,

Giovanni Razo

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...