#1
|
|||
|
|||
![]()
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.13.6 Acrobat DC FP Creator 10.1.11 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|