Barcode in dynamic table

hello people, we have searched and we can not find the how.
We have a dynamic table, which has a column that is a barcode, we generate the dynamic table but we cannot make it show us the barcode.
can you give me some help with this.
Thanks a lot.

Hi @dtraico,

Can you please tell us which version of PlanetPress Connect you’re using?

I’m not sure how much experience you have with HTML code and writing JavaScript code but from my point of view I suppose that it will be the best to:

  1. Create the Detail Table where one table column/TD-element contains the record field which contains the barcode value.
  2. Add a the barcode element to your Print Context section by Insert > Barcode > “Barcode type” (don’t forget to uncheck the option “Absolute”).
  3. Copy the HTML source code of the barcode element to use it in a Standard Script like for example:

Standard Script
Name: Example
Selector: table#example td.barcode

var result = "",
    strDataParams = "",
    objDataParams = {};

result += "<div data-params=\"@dataParams@\" style=\"width: 3in; height: 1in;\"";
result += "type=\"com.objectiflune.connect.addin.barcodes.code128\">@content@</div>";

objDataParams = {
	"grayScale": true,
	"textPosition": "BOTTOM",
	"fontFamily": "Arial",
	"backColor": "#FFFFFF",
	"codeSet": "AUTO",
	"showText": false,
	"moduleWidth": 0.03,
	"processTilde": true,
	"scale": 0,
	"fontSize": 8,
	"barColor": "#000000",
	"outputFormat": "PNG"
};

strDataParams = JSON.stringify(objDataParams).replace(/\"/g, "&quot;");

result = result.replace("@dataParams@", strDataParams);

results.each(function (index) {
	var content = this.text();
	
	if (content !== "") {
		results.html(result.replace("@content@", content));
	}
});

Please note that I’ve replaced the content of the data-params attribute with the placeholder @dataParams@ and that I’ve added the placeholder @content@ to the content of the barcode element (DIV-element). And I’ve converted the content of the data-params attribute to a JavaScript Object by replacing the &quot; values by a quote (") and adding the value to the variable “dataParams”.

At the end we will replace the content of each matching selector by the barcode element (DIV-element). We can do this by making use of the results.each() function.

P.S. This JavaScript code has been written and tested in version 2021.1.1 of the Connect Designer