Upland OL User community

Setting variable position


I’m trying to create a template that will positon a barcode on the page based on a value in the data. I can get the values in no problem but I can’t figure out how to actually move the barcode.

I was given this code from OL support:

var locx = 100;
var locy = 100;
var temp = ‘"<div anchor=“page_media_0"style=“position: absolute; overflow: hidden; box-sizing: border-box; width: 200px; height: 200px; top: 33.16319676293945px; left: 74.20320476293945px;” offset-x=”’+locx +’" offset-y="’+locy +’">"’;

where 100 would be the position variable. I’ve then added that to the script for the barcode but it doesn’t seem to do anything. Below is a screenshot the script now for barcode

Could anyone point me in the right direction as I’ve had a look at the help section that OL support sent me but I can’t make much sense of it.


I guess–based on the shared screenshot of the “barcode” Standard Script–it’s because you’re not replacing the element with the value of the variable “temp”. To do so you need to use the method replaceWith( content ), like:

results.replaceWith( temp );

But a better idea will be to replace the “temp” variable with the attr( "attributeName", "value" ) method, by which you can change the values of attribute “offset-x” and “offset-y”, for example:

results.attr( "offset-x", "96" ); // 96px == 1in
results.attr( "offset-y", "96" );

so instead of the first 3 lines which OL support sent me, just use the below?

results.attr( “offset-x”, “96” ); // 96px == 1in
results.attr( “offset-y”, “96” );

var field, result = “”;

field = record.fields[“Barcode”];
if (field !== “”) result += field;


works a treat! Thank you so much!

Hi Marten

I also need to do the same for a text box so I updated the script for that to be similar:


But doesn’t seem to be moving the position. Does it need something for this?

The reason why this doesn’t work is because you’re using “Text” as selector. Which mean that you’re trying to change the position of the text (element) “@SecurityCodeSubsPage@”. Instead of that you need to choose the “Selector”.


I’ve changed it to selector but it’s still not moving the text?

I can unfortunately not see it on the shared screenshot but:

  • Is your text box a “Positioned Box” element?
  • And are you viewing the template in “Preview” mode or in the “Design” mode?

Because it does work when you’re applying these settings to a “Positioned Box” element, and when you view the template in “Preview” mode.

Hi Marten,

I created a separate script for the setting the position and it worked fine, didn’t seem to like doing the replace and the position in the same script

May I know which version of PReS Connect you’re using?

When I use the following Standard Script in combination with a Positioned Box element I’m able to change the position and the content of the Positioned Box element:

Selector: #example

var field = "",	result = "";

results.attr( "offset-y", "96" );
results.attr( "offset-x", "96" );

field = "Hello World"; //record.fields[ "SecurityCodeFirstPage" ];
if ( field !== "" ) result += field;

results.html( result );

Used software: PReS Connect 2020.2


We are on 2018.1… Yeah I know it’s way out of date and I’m trying to get them to update to new version