1) Convert the code to a number, then use format as mentioned
2) prefix a string of 6 zeroes to the code and use the 6 rightmost characters only, in this case the padding to 6 should be ok. Maybe there is an easier way, but it works anyway...
cd := '1234'
message(format(cd,0,'<Text,5><Filler Character,0>'));
<Text,5> insert the lenght of the string you want
but be careful: if the variable is text instead of code (or the code contains a letter or symbol), the 0s will be trailing instead of leading
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
Comments
myStr := FORMAT(myInt,0,'<Integer,6><Filler Character,0>')
Hope this helps
Thomas
to fill in only "needed" zeros (which came from length of myString).
Dynamics NAV Enthusiast
1) Convert the code to a number, then use format as mentioned
2) prefix a string of 6 zeroes to the code and use the 6 rightmost characters only, in this case the padding to 6 should be ok. Maybe there is an easier way, but it works anyway...
Hope this helps
Thomas
returns 0000001234
Dynamics NAV Enthusiast
<Text,5> insert the lenght of the string you want
but be careful: if the variable is text instead of code (or the code contains a letter or symbol), the 0s will be trailing instead of leading
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog