Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Value of empty fields in the barcode

Avatar

Former Community Member

Hi

I use a custom script for my barcodes in a form with multiple instances and it works all right. There is just one little thing.

Empty field values get encoded to the barcode as ”null”. How do I change that to be just empty?

The script I use looks like this:

//{{Start Generated Content//

var is705ViewerRequired = false;

//End Generated Content}}//

function encodeBarcode() {

           var str = fieldName1.rawValue + "|"

           + xfa.resolveNode("subform1[" + this.parent.index + "].fieldName2").rawValue + "|"

           + xfa.resolveNode("subform1[" + this.parent.index + "].fieldName3").rawValue + "|"

           return str;

}

function getInstanceData(node) {

           var str = "";

           var nNodeLength = node.length;

           for (nNodeCount=0; nNodeCount < nNodeLength; nNodeCount++) {

                      str += node.item(node).rawValue + "\n";

           }

           return str;

}

this.rawValue = encodeBarcode();

Kirstine

2 Replies

Avatar

Level 1

You might substitute

node.item(node).rawValue

as

(node.item(node).rawValue!=null)?node.item(node).rawValue:""

Avatar

Level 2

i guess substituting null with empty string is best solution

.