Leading zeros

I am trying to create a numeric field without decimals with leading zeros. This could also be a character field as long as the number is right justified.

How do I do this

Thank you



Answer this question

Leading zeros

  • Ditlef Martens

    nWage = 7533.31

    cFormattedWage = Padl(Transform(nWage*100),11,"0")


  • Cider

    This should also work:

    cFormattedWage = Transform(nWage*100,"@L 99999999999")


  • IMS

    Suppose you want a 10 characters (numbers) with leading zeroes.

    nNumber = 1234

    cNumbers = Padl(Transform(nNumber),10,"0")

    HTH

     


  • DotNet_Guy

    I'm not sure if I am using the answer correctly. Let me explain further. I'm creating a text file for a taxing entity. The wage field must be 11 places with dollars and cents without decimal point, right justified and zero filled. I have 350 records in this file with wages.

    Example: the field is 753331, it needs to be 0000075331.

    Thanks for the help!!


  • Leading zeros