Newbies FileMaker_Entry Level Posted November 12, 2013 Newbies Posted November 12, 2013 Hi Daniele, I'm trying to edit your Custom Function below which i found on the forum (http://fmforums.com/forum/topic/39221-unique-serial-numers), I want to remove the "-" between the serial no. How can I do this? Author: Daniele Raybaudi Format: MonthlySerial ( AEfield ; digit ) Result: text parameters: AEfield: text - the text field wich will hold the serial number; it must be setted as auto-enter, always evaluate digit: number - the number of digit (#) that must increment by one and restart from one every new month This custom function can be used for: 1) Autoenter a serial number that increments monthly 2) the format of the serial number is essentially: YY-MM### 3) the serial number may have how many digits (#) you choosed Hi The Auto-Enter field must be setted to always evaluate; the custom function isn't recursive, so you can use it as a simple calc; the custom function will work only with FMP8 and above. 05/23/2006 */ Let([ year = Right ( "00" & Year ( Get ( CurrentDate ) ); 2 ); month = Right ( "00" & Month ( Get ( CurrentDate ) ); 2 ); lastId =GetNthRecord (AEfield; Get ( TotalRecordCount ) - 1); lastMonth = Middle ( lastId; 4 ; 2 ) ]; year & "-" & month & Case( month ≠ lastMonth or Right ( lastId ; digit ) = 10^digit -1; Right ( 10^digit ; digit-1 ) & "1"; SerialIncrement ( Right ( lastId ; digit ) ; 1 ) ) ) Thank you so much.
doughemi Posted November 12, 2013 Posted November 12, 2013 Change this line year & "-" & month to put whatever character you want between the year and the month. If you don't want any separator, make it year & month
comment Posted November 13, 2013 Posted November 13, 2013 This seems to be a popular topic recently. Please have a look at: http://fmforums.com/forum/topic/90135-how-to-reset-a-serial-number-in-a-field/?p=413659 and the link from there. Note that this was in response to a post that has been subsequently deleted, but the idea suggested there is quite similar to the one here - and the same objections apply to both.
LaRetta Posted November 13, 2013 Posted November 13, 2013 Hi FileMaker Entry Level, welcome to FMForums! :-) I agree completely with Comment … this is one of the biggest traps which befall newer folks to FileMaker.
Newbies FileMaker_Entry Level Posted November 13, 2013 Author Newbies Posted November 13, 2013 Hi Doughemi, I tried your suggestion but it didn't work for me. creating the first record is okey, but the getting the next serial is not successful. Thank you.
Newbies FileMaker_Entry Level Posted November 13, 2013 Author Newbies Posted November 13, 2013 Thanks LaRetta, for warm welcome.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now