Wednesday, December 26, 2012

Leading zeroes formatting ireport

Hi, welcome to my blog. Are you having problem formatting leading zeroes in jasper ireport
for example:

1--->001
 10-->010

Steps:
1.Right clikc the textfield -->field pattern --->put the number of zero corresponding to the number of digit you want.
2. For the above example , I have three digits so I should put  000
3. Rock it !!!!!!!!!


7 comments:

  1. Thank you very much! Works like a charm!

    ReplyDelete
  2. Replies
    1. This comment has been removed by the author.

      Delete
    2. Hello Rupa ! Please can you shed more lights on the problem you are facing. This solution should be straight forward. Once you enter for example a pattern of 00000. If your shown number is less than 5 digits then it will be preceded with zeroes. In this case: 123 ->00123; 5000 -> 05000. If it is equal or more than 5 digits (pattern) it will remain intact. Rgds

      Delete
  3. Hello, thanks for your reply,
    the field i am using is of string type, but data is of numberic type.
    & Length of data is of 21 digit with leading zeros , here i want suppress leading zeros
    Eg. if data like 000000000008000000053
    i want to show it in 10 digit.
    For this i gave pattern as 0000000000 still its not worked.
    pl. help.

    ReplyDelete
  4. I'm using iReport 0.5.0 the custom format does not exist...

    ReplyDelete