Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Barcodes

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old September 18th, 2019, 09:32 AM
dreimer dreimer is offline
Senior Contributor
 
Join Date: Oct 2010
Location: Shakopee, MN
Posts: 469
Default UPC Help

I have the following rule to create a UPC. The data usually comes in missing the leading zero. Now I have a mixture of barcodes where I don't need to add the leading zero for some records. zThe current code works great just need some code to add an if statement to add the zero if field is shorter than 11 characters and not to add it if the field has 11 characters. TIA.

Code:
// Rule converted from XML Template "Barcode 1":
// Choose the field(s) for your barcode.
// Begin XML Template selections //
var Var1 = "Barcode 1"; // "Choose a field:" (Required): FieldList
var Var2 = ""; // "Choose another field (optional):": FieldList
var Var3 = ""; // "Choose another field (optional):": FieldList
var Var4 = ""; // "Choose another field (optional):": FieldList
var Var5 = ""; // "Choose another field (optional):": FieldList
var Var6 = "IDAutomationUPCEANS"; // "Pick a font:" (Required): FontList
// End XML Template selections //
 
 
retstr = "0"+Field(Var1);
final_data = "";
 
if (Var2 != "")
        retstr += Field(Var2);
        
if (Var3 != "")
        retstr += Field(Var3);
        
if (Var4 != "")
        retstr += Field(Var4);
        
if (Var5 != "")
        retstr += Field(Var5);
        
        
final_data = '<span><f name="' + Var6 + '">' + NormalizeEntities(MakeUPCABarcode(retstr)) + '</span>';
return final_data;

Also, is there a way to turn off the warning given during composition if a particular record doesn't have said barcode?

I have 18 of these rules so some aren't always populated.
__________________
Don Reimer - JavaScript Novice

MAC OS 10.12.5 Acrobat XI 11.0.0 FP Creator 10.0.16
Windows 7 Acrobat X 10.1.4 FP Creator 9.3.9

Last edited by dreimer; September 18th, 2019 at 09:52 AM.. Reason: Additional Question
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:42 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.