COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### custum serial numbers

• Email
• Follow

```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...

```
 0

See related articles to this posting

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

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.
```
 0

```R@IDEN wrote:

> 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...
>
>
>
>

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
```
 0

```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

```
 0

```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@owlsnet.co.uk> wrote in message
> 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
>

```
 0

```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.

```
 0

```In article <1132244600.859364.20170@g47g2000cwa.googlegroups.com>, "Dan
Fretwell" <dan@owlsnet.co.uk> wrote:

> 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.

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.

Hopefully helping harassed humans happily handle handiwork hardships  ;o)
```
 0

```Dan Fretwell wrote:

> 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

```
 0

```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.

```
 0

```Dan Fretwell wrote:

> 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

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
```
 0

9 Replies
195 Views

Similar Articles

12/9/2013 8:28:18 PM
[PageSpeed]