f



Numbers formatted with leading zeros?

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
fabian (7)
1/11/2005 9:11:40 PM
comp.databases.filemaker 11053 articles. 0 followers. amosw01 (46) is leader. Post Follow

4 Replies
4941 Views

Similar Articles

[PageSpeed] 41

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
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
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
bolla (2)
11/13/2012 9:39:35 PM
On Tue, 13 Nov 2012 15:39:39 -0600, bolla wrote:
>  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

I don't know where you reply to, but it's easier to use

  right("00000" & Number, 5)

- Martin
0
Martin
11/14/2012 5:32:37 AM
Reply:

Similar Artilces:

Formatting numbers with leading zeros
Hi, I'm sort of new to Python and I've just discovered the amazing formatting using the % operator. One thing I can't figure out is how to format numbers so that they get leading zeros, for example I want the output 1x01 instead of 1x1 (used in naming my avi files of shows). I've used this so far: print '%sx%s'%(season,episode) which gives the output 1x1, but I want 1x01 =p Any way to format it using the % method? "Stian" wrote: > Hi, I'm sort of new to Python and I've just discovered the amazing > formatting using the % operator. One thing I...

number format: no leading zeros?
I'm trying to build filenames using sprintf. One part of the filename includes numbers like .001, .050, etc. However, Matlab prints decimal numbers with leading zeros, so they look like 0.001, 0.050, etc. Is there any way to get rid of the leading zeros, either by changing Matlab's format or through sprintf? Thanks! Amanda Stevens: <SNIP does not like leading zeros... one of the solutions: r=0:.01:.1; s=sprintf('%3.3f\n',r); s=strrep(s,'0.','.') us ...

format a number with leading and trailing zeros
Very simpel question. I want to format the number 2.3 to be printed as 00002.30000. I tried this: printf("%05d",2.3); which produces 00002 and this: printf("%.5f",2.3); which produces 2.30000 How can I combine these formats to print: 00002.30000? I already tgried abount a zillion combinations, but no luck so far. Any help is appreciated. Should be simple, right? Cheers, Ab absmienk@hotmail.com wrote: > Very simpel question. I want to format the number 2.3 to be printed as > 00002.30000. > I tried this: > printf("%05d",2.3); > which produces 0...

converting exponential format number to decimal format number
Hi group, is there a quick way to convert an exponential format number to decimal format number. For example, 13.534e+10 = 1353400000 I can come up a perl function but it's not perly. Can I get some help please? Thanks, "Fei Liu" <fei.liu@gmail.com> wrote: > 13.534e+10 perl -e "print 13.534e+10" 135340000000 perl -e "my $var = 13.534e+10; print length $var" 12 So at least here (WinXP+ActiveState) Perl does this internally. -- John Experienced Perl programmer: http://castleamber.com/ Perl help, tutorials, and example...

Formatting to delete leading zeroes
How do I use sprintf() to delete a leading zero before the decimal point? E.g., $num = 0.25 and I want $num = .25. I don't want to delete any posiive integers, only the zero if there's no positive integer, i.e., 9.54 shows as 9.54, but 0.54 shows as .54. Thanks, -- JR >>>>> "j" == junior <junior@iam.invalid> writes: j> How do I use sprintf() to delete a leading zero before the decimal point? j> E.g., $num = 0.25 and I want $num = .25. I don't want to delete any j> posiive integers, only the zero if there's no posi...

Incrementing Number/Leading Zeros
Hey All, I know this has been addressed in a few different conversations but none are exactly what I am trying to do, bear with me I am an access Newbie. Basically I have a form that assigns Run Numbers to each record (EMS agency, each record is a Run Number, versus like a PO number or Work Order..). Right now I have a field which I call "displayedRunNumber" stored in a table as a number. The default value in the table is 0. In the form where the counter is viewed I have a before update code of: Private Sub Form_BeforeUpdate(Cancel As Integer) If Me.NewRecord Then Me!displa...

DataBase DataBase DataBase DataBase
DataBase DataBase DataBase DataBase Porfessional Programmable Database Ver. 2.0 2.1 Million Record Capacity. Search Rate: 2000/Records/Second. DataBase Type: Random Access. Can Create Unlimited Databases. Programmable fields for any Application. Build Time One Second, (Auto Creates DB). Setup Time: Instantly, Just Enter DB Name. Ultra Easy to Learn (Typically 30 Seconds) Ultra Cheap Price, Special $20, Paypal Accepted. Application Mailed Instantly (file Attached Email). Easy Paypal Online Ordering. See Site Below. http://www.vehiclerepair.org/dbPro/dbpro.html Scott: #DataBase...

Integer number with no leading zeros
Can you tell me how extract leading zeros from a specified number ? $ @verify Please enter number: 003456 integer number is 3456 $ (I'm confuse with f$fao lexical...) Regards. apogeusistemas@gmail.com wrote: > Can you tell me how extract leading zeros from a specified number ? > > $ @verify > Please enter number: 003456 > integer number is 3456 > $ I'm not sure I understand what you are trying to do. The procedure you have appears to extract the number correctly, even with the leading zeros. Are you wanting something to product this: $ @show_zeros Please en...

Adding leading zeros to numbers?
I recently posted asking how I could keep the length of my numbers I am outputting constant. As in I need 3208 to be the same length as 300 (with leading zeros such as 0300). However, the only way I have learned to do this is through the sprintf('%4.4d',x) which turns my number into a 1x4 which my array I am putting the number into does not like! Any suggestions on how to retain 1x1 format yet add leading zeros? Thanks in advance, Eli G. Hi, Eli G. wrote: > I recently posted asking how I could keep the length of my numbers I > am outputting constant. As in I need 3208 to be t...

Number entry (leading zeros)
I am sure there is a simple answer. I have a database that where I am trying to setup a security login based on employee number. Employee number is a 5 character numeric field. The databse has a sql odbc link into the HR system to pull the emp number, emp name, and a few other key fields. Because of the way the sql/odbc link is - this field is a text field Example emp numbers are: 00063 01222 On the login form, I have an unbound text box. I've put an input mask of "00000" and default value of 0 I would like to make it so that the data entry starts from the right side of t...

DataBase DataBase DataBase DataBase
DataBase DataBase DataBase DataBase Porfessional Programmable Database Ver. 2.0 2.1 Million Record Capacity. Search Rate: 2000/Records/Second. DataBase Type: Random Access. Can Create Unlimited Databases. Programmable fields for any Application. Build Time One Second, (Auto Creates DB). Setup Time: Instantly, Just Enter DB Name. Ultra Easy to Learn (Typically 30 Seconds) Ultra Cheap Price, Special $20, Paypal Accepted. Application Mailed Instantly (file Attached Email). Easy Paypal Online Ordering. See Site Below. http://www.vehiclerepair.org/dbPro/dbpro.html ...

Time format with leading zero?
Hi folks, Am I going mad or losing my memory? I surely must have encountered this a million times before! Is there not a format (available in v8.2) which produces what I would have thought was the most commonly required format for a time variable, namely HH:MM with HH padded with a leading zero if necessary - i.e. 07:59, rather than 7:59 (which is what time5. appears to produce)? There are obviously workarounds one could implement, but I just find it hard to believe that such an intrinsic format does not exist! TIA. Kindest Regards, John -----------------------------------------------...

SQL Format leading zeros
HELP! SOS! I have a field that I'm trying to format within a query. The results from my field "Appointment.EMP_FILE_NB" give various numbers: (e.g.: 213 105523 125400 1245 834 When what I want is: 000213 105523 125400 001245 000834 SELECT Employment.PREFERRED_NAME, Employment.LAST_NAME, Appointment.JOB_TITLE, Appointment.BU_NAME, Appointment.CO_C, Appointment.EMP_FILE_NB FROM Employment INNER JOIN Appointment ON (Employment.EMPL_NO = Appointment.EMPL_NO) AND (Employment.PERSON_ID = Appointment.PERSON_ID) WHERE (((Appointment.APPT_START_DATE)<=Date()) AND ((Appointment.AP...

Formatting an integer with leading zeros
Is there a "java" way to format int values as strings with leading zeros? I've reviewed many posts and the solutions involved rolling your own with prepending a "0" as necessary until getting the desired result. A far cry from C's %5d Thanks "GIMME" <gimme_this_gimme_that@yahoo.com> wrote in message news:3f12b4fb.0402111120.1b938ed1@posting.google.com... > Is there a "java" way to format int values as strings with > leading zeros? > > I've reviewed many posts and the solutions involved rolling > your own with prepen...

Web resources about - Numbers formatted with leading zeros? - comp.databases.filemaker

Formatted text - Wikipedia, the free encyclopedia
Formatted text cannot rightly be identified with binary files or be distinct from ASCII text. This is because formatted text is not necessarily ...

Received a badly formatted email on your mobile? 75 percent of you will delete it
A survey by Constant Contact shows that mobile devices are more important than ever, particularly to those under the age of 30. The study reveals ...

Quickly view formatted PDFs in your search results
Google search results sometimes include documents that were not originally formatted to be viewed in a web browser, such as PDFs. In the past, ...

Now in Google search results: Formatted PDFs
Google has launched a new search option called Quick View that allows users to open formatted PDF filesnot just HTML viewing of documentsfrom ...

Proxy ports showing formatted text in Mountain Lion
An interface bug in the OS X Network system preferences shows unconventional port string formats, but does not affect OS X performance.

It’s Markdown, no, PowerShell. Wait its Markdown formatted PowerShell.
... "Current DateTime is = $([System.DateTime]::Now)" ### Escape characters with the ` (back-tick) "Escape a quotation `"This is quoted`"." Formatted ...

Exploit can control older Macs even after they're formatted
Exploit can control older Macs even after they're formatted

HBO cancels 'In Treatment' 'as previously formatted'
HBO just made it official: In Treatment will not return for a fourth season. The psychotherapist drama won plenty of critical acclaim and Emmy ...

FAA GPS data formatted for your use
[Michael] posted up-to-date GPS data sets in the GPX format . These data sets are an alternative to paid updates. Since GPX is a published standard ...

Converting Mac-formatted iPod to Windows - iLounge Article
Q: In reading your FAQ and previous columns, I see that it is possible to use a Mac-formatted iPod on a Windows PC through the use of a third-party ...

Resources last updated: 1/24/2016 2:50:52 PM