Dr.Hamed Posted November 9, 2013 Posted November 9, 2013 Hi I have an auto entry calculation field with value from the field "serial" which has serial increment Right(Year(Get (CurrentDate));2) & "-" & Right("0"&Month(Get (CurrentDate));2) & Right(("000"&serial);4) The output of which is: yy-mm#### ; 13-110435 .... 13-110436 ......... How can I make calculation to reset the value "serial" in order to start from 1 at the beginning of every new month Thanks
Wim Decorte Posted November 9, 2013 Posted November 9, 2013 There is a script step for "Set Next Serial Number" if your "serial" is a true auto-enter serial field.
Dr.Hamed Posted November 9, 2013 Author Posted November 9, 2013 With what I have, just creating a new record (Ctrl n) will show up the calculated value in the field "Case_ID" Would this be still possible with the script? And the other thing how to auto reset the value when the month changes?
comment Posted November 10, 2013 Posted November 10, 2013 I think there are some assumptions here that are worth checking: This script, attached to Case_ID with an OnObjectModify script trigger Why would the user modify the Case_ID field? Set Variable [$lastRecCalcMonth; Value:GetNthRecord (YourTable::Case_ID ; Get ( RecordNumber )-1)] You are assuming that the most recent record is included in the current found set, and that the current sort order places it just before the current record. Note also that the script will run (probably) while the new record is still uncommitted. A second user, creating a new record while this one is still uncommitted, will reset the serial again and create a duplicate. See also:http://fmforums.com/forum/topic/90112-calculation-help-with-serial-in-pk/?p=413582
Recommended Posts
This topic is 4370 days old. Please don't post here. Open a new topic instead.
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