03-03-2023 07:30 AM
How can i take a sql result field where I am counting the number of people in the file for a trailer and left pad with zeroes? I have tried a bunch of the expressions shown in several of the answers here but nothing is working. I get
Solved! Go to Solution.
03-03-2023 07:54 AM
It is because the COUNT is an integer, try with this:
"0000000000".slice($COUNT.toString().length) + $COUNT
03-07-2023 10:46 AM
This is the one I always use
Where 9 is the size you want and text2 is you data (-9 negative of size you want)
‘0’.repeat(9).concat(text2).slice(-9)
Explain:
text1 = “000000000”; //length you want
text2 = “1234”;
result = “000000000”.concat(text2);
0000000001234
//returns last number of characters
let result2 = result.slice(-9); //length you want
000001234
‘0’.repeat(9).concat(text2).slice(-9)