ReminderVDP Posted June 13, 2022 Share Posted June 13, 2022 I am generating QR codes for the front and back pieces of artwork using the Graphic Rule QR Barcode. I created the rule and added the box to the artwork pages. It is appearing on a record where the field that is generating the QR code is blank in the data. Why is the QR code still generating when there is no data in the field? The code from the Rule is below. // Rule converted from XML Template "QR Barcode: qrShortUrl": // Choose the following values: // Begin XML Template selections // var RuleOrFieldToEncode = "qrShortUrl"; // "Data field or rule to encode" (Required): FieldOrRuleList var EncodingMode = "Byte"; // "Encoding mode" (Required): PickList ["Byte" (All characters), "AlphaNumeric" (Alphanumeric only), "Numeric" (Numeric only)] var ErrorCorrectionMode = "Q"; // "Error correction" (Required): PickList ["L" (Low), "M" (Medium), "Q" (Quality), "H" (High)] var PreferredFormat = "0"; // "Format (symbol size)" (Required): PickList ["0" (0 (automatic)), "1" (1 (21x21)), "2" (2 (25x25)), "3" (3 (29x29)), "4" (4 (33x33)), "10" (10 (57x57)), "40" (40 (177x177))] var ProcessTilde = false; // "Process tilde (~) escapes": CheckBox var foreColor = "Black"; // "Barcode color (optional; defaults to Black):": ColorList // End XML Template selections // var DataToEncode = RuleOrField(RuleOrFieldToEncode); return MakeQRBarcodeGraphic(DataToEncode, ProcessTilde, EncodingMode, ErrorCorrectionMode, PreferredFormat, foreColor); Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted June 15, 2022 Share Posted June 15, 2022 A barcode with no data is still valid. If you want nothing to appear when the data field is empty, put this before the return line: if (!DataToEncode) return NullResource(); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.