![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
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. |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
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 |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
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. |
#8
| |||
| |||
|
|
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 |
#9
| |||
| |||
|
#10
| |||
| |||
|
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |