Hi all,
I want to have a field which is a serial number, formatted so that it
is always x number of digits with zeros filling in to the left like
"00462", "0003" etc.
I have no idea how to do this without a tremendous kluge, and I welcome
any and all suggestions.
My kluges are (I'll spare you the pseudocode):
1. Make the number into a string, count characters, concatenate "0"s to
the left until full. wash rinse repeat.
or
2. Make an "odometer" with five (or however many) individual variables:
x1, x2, x3, x4, x5; increment until x1 == 9, rollover over to x2 and
reset x1 to 0. repeat for each of the subsequent variables. Would have
to line them up to look like one number.
OK, problems: #1 leaves me with a string, not a number; #2 leaves me
with five individual numbers, and besides it is _way_ too complicated.
I'm sure this is something I missed in high-school math ... and I ran
a check on the archives but didn't find anything.
Thanks in advance,
jon
--
ls: .sig: No such file or directory
|
|
0
|
|
|
|
Reply
|
fabian (7)
|
1/11/2005 9:11:40 PM |
|
I'm confused over how many digits you are looking for, or if it might be
different for every entry.
If you always want the final number to have five digits, for example,
make the field a text field with auto-enter serial number with the 'next
serial number' set to be 00001. This will increment correctly and will
always have five digits. It must be a text string, as numbers cannot
have leading zeroes.
Or to take any length number and add leading zeroes to a certain length:
right("00000" & YourNumber, 5)
The calc result must be set to be text, for the same reason as above.
jon fabian wrote:
> Hi all,
>
> I want to have a field which is a serial number, formatted so that it
> is always x number of digits with zeros filling in to the left like
> "00462", "0003" etc.
>
> I have no idea how to do this without a tremendous kluge, and I welcome
> any and all suggestions.
>
> My kluges are (I'll spare you the pseudocode):
>
> 1. Make the number into a string, count characters, concatenate "0"s to
> the left until full. wash rinse repeat.
>
> or
>
> 2. Make an "odometer" with five (or however many) individual variables:
> x1, x2, x3, x4, x5; increment until x1 == 9, rollover over to x2 and
> reset x1 to 0. repeat for each of the subsequent variables. Would have
> to line them up to look like one number.
>
> OK, problems: #1 leaves me with a string, not a number; #2 leaves me
> with five individual numbers, and besides it is _way_ too complicated.
>
> I'm sure this is something I missed in high-school math ... and I ran
> a check on the archives but didn't find anything.
>
> Thanks in advance,
>
> jon
>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Pro Solutions Los Angeles, California
FileMaker 7 Certified Developer
Associate Member, FileMaker Solutions Alliance
|
|
0
|
|
|
|
Reply
|
Howard
|
1/11/2005 9:17:46 PM
|
|
D'Oh! I _knew_ I was missing something ... in this case brain cells.
For clarification, I want to have the same number of digits in the
field for every record.
Thanks!
Jon
In article <10u8gju6rkhra1@corp.supernews.com>, Howard Schlossberg
<howard@antispahm.fmprosolutions.com> wrote:
> If you always want the final number to have five digits, for example,
> make the field a text field with auto-enter serial number with the 'next
> serial number' set to be 00001. This will increment correctly and will
> always have five digits. It must be a text string, as numbers cannot
> have leading zeroes.
--
ls -al: .sig: No such file or directory
|
|
0
|
|
|
|
Reply
|
jon
|
1/12/2005 3:41:30 PM
|
|
You can make a string like this:
If ($Number<10 ; "000" ; If ( $Number<100 ; "00" ; If( $Number<1000 ; "0" ; "" ) ) ) & $Number
Numbers then look like: 0003. 0023, 0234, 2345
--
|
|
1
|
|
|
|
Reply
|
bolla (2)
|
11/13/2012 9:39:35 PM
|
|
|
2 Replies
1228 Views
(page loaded in 0.069 seconds)
Similiar Articles: Numbers formatted with leading zeros? - comp.databases.filemaker ...Hi all, I want to have a field which is a serial number, formatted so that it is always x number of digits with zeros filling in to the left like "00... Is there a format to print time values with leading zeros? - comp ...Numbers formatted with leading zeros? - comp.databases.filemaker ... Is there a format to print time values with leading zeros? - comp ... How to Add Leading Zeros in ... Leading Zeroes Dropping in Excel - comp.lang.java.helpLeading Zeroes Dropping in Excel - comp.lang.java.help How to Add Leading Zeros in Excel | eHow.com Microsoft Excel's general number format drops leading zeros ... count leading zero - comp.lang.asm.x86Numbers formatted with leading zeros? - comp.databases.filemaker ... Hi all, I want to have a field which is a serial number, formatted so that it is always x number of ... reading negative values with leading zeros - comp.soft-sys.sas ...Numbers formatted with leading zeros? - comp.databases.filemaker ... Numbers formatted with leading zeros? - comp.databases.filemaker ... reading negative values with ... 0-padding 4 digit numbers with sed - comp.unix.shellNumbers formatted with leading zeros? - comp.databases.filemaker ... 0-padding 4 digit numbers with sed - comp.unix.shell Numbers formatted with leading zeros? - comp ... removing leading character from left,right a string - comp.lang ...Numbers formatted with leading zeros? - comp.databases.filemaker ... Make the number into a string, count characters, concatenate "0"s to the left until full ... How do I determine whether a text string is a number/whole/integer ...Numbers formatted with leading zeros? - comp.databases.filemaker ... convert integer to string - comp.lang.perl.misc I get ... fread and float - comp.soft-sys.matlab ... Taking the log of variable with Positive, Zero and Negative Values ...Numbers formatted with leading zeros? - comp.databases.filemaker ..... to 0. repeat for each of the subsequent variables. ... There are several ways to prevent values ... How to get a number with 2 decimal, whatever this number is ...Numbers formatted with leading zeros? - comp.databases.filemaker ... How to get a number with 2 decimal, whatever this number is ... Number display format - comp.soft-sys ... How to: Pad a Number with Leading Zeros - Microsoft Corporation ...You can pad an integer with leading zeros by using the "D" standard numeric format string together with a precision specifier. You can pad both integer and floating ... Using a custom number format to display leading zerosIn Microsoft Excel, you can use either of two methods for using a custom number format to display leading zeros. Use one method for fixed-length numbers ... 7/24/2012 4:22:49 AM
|