3 Replies Latest reply on May 27, 2013 3:07 PM by philmodjunk

    Number formatting

    Kaps_1

      Title

      Number formatting

      Post

           How do I make numbers less than a hundred have trailing zeroes. e.g want 5 to appear as 005, 12 as 012 and 235 as itself ? thanks

           regards

           Kaps

            

        • 1. Re: Number formatting
          GuyStevens

               You will need two fields. One field where you enter the number. And a calculation field that adds the leading zeroes.

               Let's say you have a field called "Number"  as a number field where you enter your number.

               You then make a calculation field called "c_Number_Zeroes" (for instance) where you create the following calculation:

               Right ( "000" & Number ; 3 )

               This means you will be combining "000" with your number.

               12 will become 00012.
               1 will become 0001
               235 will become 000235.

               But the Right function takes only 3 characters from the right side.

               So you will always end up with 3 characters and leading zeroes.

          • 2. Re: Number formatting
            Kaps_1

                 Thanks - obvious when you think about it !!

            • 3. Re: Number formatting
              philmodjunk

                   A text field with an auto-enter calculation could do this with a single filed instead of two--though that may not be a better option in all cases:

                   Right ( "000" & GetAsNumber ( self ) ; 3 )

                   Make sure to clear the "do not replace existing value..." check box.