In Crystal Report using Visual Studio 2010, I am trying a to create a formula for the following scenario:
x = any number (Fixed number of 8 digits, cant be less or greater)
If Length of X is less than 8, pad the required amount of 0's in the front to make its length 8.
Eg:
X = 123 Result of Formula should be 00000123 X = 9 Result of Formula should be 00000009
Any help will be appreciated. Thanks in advance.
To pad an integer with leading zeros to a specific length To display the integer as a decimal value, call its ToString(String) method, and pass the string "Dn" as the value of the format parameter, where n represents the minimum length of the string.
Zero padding is a technique typically employed to make the size of the input sequence equal to a power of two. In zero padding, you add zeros to the end of the input sequence so that the total number of samples is equal to the next higher power of two.
Calling the code to add the leading zeroes from the Mapping BAdI. method IF_ARBERP_BADI_OUTB_MAP~MAP_BUS2012_TO_ORDR_OUT.
A leading zero is any 0 digit that comes before the first nonzero digit in a number string in positional notation. For example, James Bond's famous identifier, 007, has two leading zeros. When leading zeros occupy the most significant digits of an integer, they could be left blank or omitted for the same numeric value.
ToText({table.field},"00000000")
is more succinct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With