November 12, 201312 yr Newbies 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.
November 12, 201312 yr 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
November 13, 201312 yr 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.
November 13, 201312 yr 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.
November 13, 201312 yr Author Newbies 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.
Create an account or sign in to comment