Print bar code type base on data length

Issues related to label design (working with databases, data processing, RFID encoding etc.) and printing (from NiceLabel Express, NiceLabel Pro, NiceForm and NicePrint)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
kelvin.leung
Valued Contributor
Posts: 29
Joined: Wed Jul 30, 2008 10:34 am

Print bar code type base on data length

Post by kelvin.leung » Thu Apr 30, 2009 8:57 am

Hi guys,

Is there any way I can print a bar code which bar code type is vary based on a data field length? For example, if a data field is 12 characters long, it print a UPC bar code. If it is 13 characters long, it print a EAN bar code.

Thanks

User avatar
Saso
NiceLabel
NiceLabel
Posts: 2984
Joined: Mon Sep 04, 2006 8:09 am
Contact:

Post by Saso » Mon May 04, 2009 3:16 pm

Yes, you can! :)

However, some VB Scripting is necessary to determine the length of the variable and then decide which bar code to print.

The workflow is:
  • Create a label with two bar codes: UPC and EAN.
  • Create one keyboard-entry variable.
  • Create two VB script functions.
  • The first VB Script determines if the length of the variable is 12 characters. In that case the output function-generated variable is assigned with the same value.
  • The second VB Script determines if the length of the variable is 13 characters. In that case the output function-generated variable is assigned with the same value.
  • Link each function-generated variable with the separate bar code object, UPC and EAN.
  • Only one of the funtion-generated variables will have a value and will print out.
  • If the variable linked with some object does not have a value, the object will not print on the label.
See a sample here.
Open the label conditional objects.lbl.
Saso Fleiser
Senior Technical Product Specialist

Milan Nagy
Enthusiast
Posts: 8
Joined: Thu Jul 26, 2007 11:23 am

Post by Milan Nagy » Tue May 05, 2009 8:36 am

Hi Saso,

Thanks for sample label. But how can I do this with graphic objects?
I added one graphic object to your sample label and connected it with EAN13 function (. When the length of input variable was 11 characters the UPC-A barcode was printed, but when the length was 12char. error message was shown: "Invalid value for object! Production aborted! Error occurred in variable EAN13!"

User avatar
Saso
NiceLabel
NiceLabel
Posts: 2984
Joined: Mon Sep 04, 2006 8:09 am
Contact:

Post by Saso » Wed May 20, 2009 7:50 am

Which graphic object? Are you referring to the image/picture object? Do you want to print variable image on the label?

I am not sure what you changed on the sample label that I provided and what you have corrupted. :wink:

Could you please explain in more details what you are trying to achieve.
Saso Fleiser
Senior Technical Product Specialist

Post Reply