1

I have a series of numbers that need to be formatted as xxx-xxxx, with leading zeroes preserved when applicable. For example, I need make sure 025-5632 is not reformatted as 25-5632. I found in the "custom" format I can change it to "00#-####" in order to automatically add leading zeroes, but this changes ALL entries to have leading zeroes, not just those that are lacking other leading numbers (e.g. 123-4567 would become 00123-4567).

Can anyone tell me if it's possible to preserve leading zeroes in a numerical field?

I would also like to preserve the dash, if at all possible, but this is a little bit less of a necessity. Apparently, this has been done before by the person I am working for, but they cannot figure out how to do it in their updated system. For reference, we will be typing these numbers in one by one, not using a table import.

1
  • 1
    To preserve leading zeroes in a "numerical" field you need to use a text field.
    – PolyGeo
    May 22, 2023 at 21:56

1 Answer 1

1

To store numbers with the dash and leading zeroes, you need to use a text field, not numeric.

However, you can display numeric fields with a dash and leading zeroes, though they are still stored as numbers with no formatting. To do so:

  • Leave your field as a numeric type (e.g. long integer).

  • Open Data Design -> Fields

  • Change the Number Format to Custom and use the format string 000-0000. The "0" placeholder replaces the zero with the given digit of the field if one is present, otherwise with zero.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.