dbTalk Databases Forums  

custum serial numbers

comp.databases.filemaker comp.databases.filemaker


Discuss custum serial numbers in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
R@IDEN
 
Posts: n/a

Default custum serial numbers - 11-17-2005 , 04:39 AM






i have to create script for generating serial numbers...



something like this


R Y XXX - NO


R=4 fix number
Y=5 for (2005y)
XXX= number of the day in a year (1-365)
-
NO= serial number in a day. 01,02,03,04,05,06....

-*-*-*-*-
exsample
45001-01

4 ok, 5=2005year, 001 means 1.1.2005g, - number of something...




Please help.

Reply With Quote
  #2  
Old   
Jens Rasmussen
 
Posts: n/a

Default Re: custum serial numbers - 11-17-2005 , 05:03 AM






Then it is not -really- a serial number, I would say.

A more helpful hint:
Make a 'real' serial number: start with -01, reset this every morning
with the step Set Next Serial Number.
Make a calc field do the rest.

Reply With Quote
  #3  
Old   
Matt Wills
 
Posts: n/a

Default Re: custum serial numbers - 11-17-2005 , 06:15 AM



R@IDEN wrote:

Quote:
i have to create script for generating serial numbers...



something like this


R Y XXX - NO


R=4 fix number
Y=5 for (2005y)
XXX= number of the day in a year (1-365)
-
NO= serial number in a day. 01,02,03,04,05,06....

-*-*-*-*-
exsample
45001-01

4 ok, 5=2005year, 001 means 1.1.2005g, - number of something...




Please help.
You'll need a separate field to maintain the sequential serial number,
which in this calculation is YourSerial. You could do that with a
simple auto-enter serial, or a script to increment a global field. This
calc gives you a format matching your "45001-01" example:

YourField = "4" & Right ( Year ( Get ( CurrentDate ) ); 1) & Right (
"00" & DayOfYear ( Get ( CurrentDate ) ); 3 ) & " - " & Right ( "00" &
YourSerial ; 2 )

Matt


Reply With Quote
  #4  
Old   
Dan Fretwell
 
Posts: n/a

Default Re: custum serial numbers - 11-17-2005 , 09:25 AM



I'm not saying that it is helpful here but the function SerialIncrement
which is in version 8 and 7 (I don't know about earlier versions)
pretty much redefines what FMP means by a serial number. This also
applies to Auto-enter serial number. You can enter virtually any
combination of text and numbers so long as it ends with a clearly
separated number (separated by anything which is not a number). So, for
example, you can set your first serial as CLI0001 and then it will
happily increment to CLI0002 etc


Reply With Quote
  #5  
Old   
Bill Marriott
 
Posts: n/a

Default Re: custum serial numbers - 11-17-2005 , 09:50 AM



Dan,

FileMaker has long been able to do this -- since at least version 2.0 --
with serial numbers. What is new is the function to expose this in
Calculations.

Bill

"Dan Fretwell" <dan (AT) owlsnet (DOT) co.uk> wrote

Quote:
I'm not saying that it is helpful here but the function SerialIncrement
which is in version 8 and 7 (I don't know about earlier versions)
pretty much redefines what FMP means by a serial number. This also
applies to Auto-enter serial number. You can enter virtually any
combination of text and numbers so long as it ends with a clearly
separated number (separated by anything which is not a number). So, for
example, you can set your first serial as CLI0001 and then it will
happily increment to CLI0002 etc




Reply With Quote
  #6  
Old   
Dan Fretwell
 
Posts: n/a

Default Re: custum serial numbers - 11-17-2005 , 10:23 AM



Bill

I wish I had known that years ago. I've spent time making these
combined text and number field calculations in FMP3, which is my only
early version, and you are spot on it accepts text as a serial number.
The help file (in version 3) is a bit coy about this ability.


Reply With Quote
  #7  
Old   
Helpful Harry
 
Posts: n/a

Default Re: custum serial numbers - 11-17-2005 , 01:49 PM



In article <1132244600.859364.20170 (AT) g47g2000cwa (DOT) googlegroups.com>, "Dan
Fretwell" <dan (AT) owlsnet (DOT) co.uk> wrote:

Quote:
I wish I had known that years ago. I've spent time making these
combined text and number field calculations in FMP3, which is my only
early version, and you are spot on it accepts text as a serial number.
The help file (in version 3) is a bit coy about this ability.
It's something I've been doing for years. For example if I have two
files with serial numbers, then in FileA the serial number would be
Axxxx and in FileB it would be Bxxxx. You only need a calculation if
you're wanting to add changing bits like the Month the record is
created.

This ability has nothing to do with serial numbers as such. It's really
just a useful side-effect of FileMaker's forgiving nature about
"inter-swapability" of field Text and Number types - Number fields can
contain letters and Text fields are able to be used in number functions
like Sum.


Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
  #8  
Old   
Matt Wills
 
Posts: n/a

Default Re: custum serial numbers - 11-18-2005 , 05:33 AM



Dan Fretwell wrote:

Quote:
I'm not saying that it is helpful here but the function
SerialIncrement which is in version 8 and 7 (I don't know about
earlier versions) pretty much redefines what FMP means by a serial
number. This also applies to Auto-enter serial number. You can enter
virtually any combination of text and numbers so long as it ends with
a clearly separated number (separated by anything which is not a
number). So, for example, you can set your first serial as CLI0001
and then it will happily increment to CLI0002 etc
So what am I missing in implementing this?

I built this calculation

SerialIncrement ( Right ( Year ( Get ( CurrentDate ) ); 2) & DayOfYear
( Get ( CurrentDate ) ) & "000"; 1)

which, for November 18, 2005, returns

05322001

but how do I get it to increment?

I try it as an autoenter, I get the same "number" in the new record.
Same thing in a straight calc field definition.

I also tried a simpler SerialIncrement ( "ABC000"; 1) with the same
non-results:

ABC001, no change in a new record.

Matt



Reply With Quote
  #9  
Old   
Dan Fretwell
 
Posts: n/a

Default Re: custum serial numbers - 11-18-2005 , 07:03 AM



Let me answer back to front. If you enter ABC000 into the "next value"
box of Auto-enter Serial number and the 1 into the "increment" by box
then it will increment on each new record. This is a reasonable use of
auto-enter serial and as Bill has pointed out has been available for a
long time.

To get the SerialIncrement function to work you have to give it
precisely what you want it to increment. So giving it the calculation
with 000 on the end and 1 as an increment will always result in 001 on
the end. If you want to enter it as an Auto-enter then you have to get
the previous incremented value into the auto-enter box. There are ways
of doing this. One which I have used in version 7 is to define a second
TO of my table, relate by cartesian join and then sort the table by
your serial number descending. Then replace the auto-enter by

SerialIncrement(NewTO::Serial;1)

This works provided your serial sorts so that the number to increment
lands at the top. However, it won't restart numbering on a daily basis.
As I said I am not sure how helpful it is here. I think it is probably
best used in a scripted solution and is just an alternative method to
separating out the number and adding 1.


Reply With Quote
  #10  
Old   
Matt Wills
 
Posts: n/a

Default Re: custum serial numbers - 11-19-2005 , 07:01 AM



Dan Fretwell wrote:

Quote:
Let me answer back to front. If you enter ABC000 into the "next value"
box of Auto-enter Serial number and the 1 into the "increment" by box
then it will increment on each new record. This is a reasonable use of
auto-enter serial and as Bill has pointed out has been available for a
long time.

To get the SerialIncrement function to work you have to give it
precisely what you want it to increment. So giving it the calculation
with 000 on the end and 1 as an increment will always result in 001 on
the end. If you want to enter it as an Auto-enter then you have to get
the previous incremented value into the auto-enter box. There are ways
of doing this. One which I have used in version 7 is to define a
second TO of my table, relate by cartesian join and then sort the
table by your serial number descending. Then replace the auto-enter by

SerialIncrement(NewTO::Serial;1)

This works provided your serial sorts so that the number to increment
lands at the top. However, it won't restart numbering on a daily
basis. As I said I am not sure how helpful it is here. I think it is
probably best used in a scripted solution and is just an alternative
method to separating out the number and adding 1.
OK, I have it now.

The first parameter of the SerialIncrement function is not just the
format, but in also includes the last value, to which the second
parameter is added.

Something else FM could have explained a little better in Help.

Now that I have it, though, I don't think I have much use for it. A
calculation works just fine on its own without adding the function
wrapper.

Matt


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.