Hello,
in a database there is a counter with one to three digits. How can I fill the counter with zeros.
Regular 1,2,3,4
Desired 001, 002-009, 010,011…etc.
How does this work?
Thanks a lot.
Hello,
in a database there is a counter with one to three digits. How can I fill the counter with zeros.
Regular 1,2,3,4
Desired 001, 002-009, 010,011…etc.
How does this work?
Thanks a lot.
Not sure if it works in the version of OL Connect you are running but try the following in the script of your template:
let paddedCounter = String(record.fields.Counter).padStart(3,'0');
results.text( paddedCounter )
Erik
padStart should work, I verified that it is available in 2022.1 and older.
As an alternative you could do:
formatter.number(record.fields.Counter, "#000")
Thanks a lot. It works:
var field, result = “”;
field = record.fields[“SDNR”];
if (field !== “”) result += field;
let paddedCounter = String(record.fields.SDNR).padStart(3,‘0’);
results.text( paddedCounter )
This text will be hidden