I am new to planet press connect and making strides. Self learning. I have a sequence number that I need to pad with zeros, but have no idea how. I need every sequence number to be six digits.
examples:
000001; 000010; 000100; 001000; 010000; 100000.
Here is the source code. I tried using the prefix but it makes my 10 sequence numbers seven digits.
add(record.fields[“ID”], function (value) { result += value; });
Just got it figured. Here is full code. Please share if there is a better way.
function padDigits(number, digits) {
return Array(Math.max(digits - String(number).length + 1, 0)).join(0) + number;
}
{
function add(value, operation) {
if (value === undefined || value === “”)
return;
operation(value);
}
var result = "";
// padDigits(9, 4);
add(record.fields[“ID”], function (value) { result += value; });
results.html(padDigits(result, 6));
}