MarcomCentral (PTI) and FusionPro User Communities

MarcomCentral (PTI) and FusionPro User Communities (
-   Issues, Questions, Etc. (
-   -   QR code Returning Graphic when Field is Empty (

ReminderVDP June 13th, 2022 11:30 AM

QR code Returning Graphic when Field is Empty
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);

Dan Korn June 15th, 2022 09:05 AM

Re: QR code Returning Graphic when Field is Empty
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();

All times are GMT -7. The time now is 06:53 PM.

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