Jscott Posted January 12, 2006 Posted January 12, 2006 I have a single field that is setup to assign a specific number R-06-0001 when a record is created. What I am trying to do is that if one of two buttons are pressed after information is placed into that record that the number change to either a CRNA-06-0001 or ME-06-0001. Can this be done?
Wim Decorte Posted January 13, 2006 Posted January 13, 2006 Sure. The logic seems to be that if a certain script is run, the left of the original string up to the first "-" gets replaced by either "CRNA" or "ME". You'll need the Position function to get the position of the first "-", then the Right function to take the serial string starting from that position and then concatenate the desired prefix with what you've grabbed from the original serial
comment Posted January 13, 2006 Posted January 13, 2006 (edited) The left of the original string up to the first "-" is the first word, so you can make it simple: Substitute ( SerialID ; LeftWords ( SerialID ; 1 ) ; "CRNA" ) Note that is assumes the rest of the string is strictly numeric, or at least does not contain the "R" character. Edited January 13, 2006 by Guest
Jscott Posted January 15, 2006 Author Posted January 15, 2006 Ok... What I am trying to do is this... When a Record is created it is assigned a serial # called "R-06-0001" I have two other fields, one called MENUMBER and the other CRNANUMBER. What I want to do is that if button "A" is depressed than a serial number is placed into the CRNANUMBER field and if button "B" is depressed than a serial number is placed into the MENUMBER field. However, although every record will have a R-06-00001 number, the record cannot have both a CRNA and an ME number. This is where I am confused. Thanks
Raybaudi Posted January 15, 2006 Posted January 15, 2006 Hi try this P.S. I maded it with only one button, but it is easy to change to two buttons, if you wish ! SerialNumbers.zip
Jscott Posted January 15, 2006 Author Posted January 15, 2006 Ok.. Close, but all three numbers must remain unique from each other in that they all must have their own unique # that increments independently from each other. That is where I am confused. Thanks
Raybaudi Posted January 15, 2006 Posted January 15, 2006 So the first one isn't a serial number ! (if it is, please give me an example of when it must increment) Only ME and CRNA are serials ? (one of them is always not empty or sometimes both can be empty ?)
Jscott Posted January 15, 2006 Author Posted January 15, 2006 The first number (R-06-0001) is a serial # that is unique and really doesn't apply to my problem. The CRNA # needs to be a unique serial # that increments like this (CRNA-06-001, CRNA-06-002 etc.) The ME # needs to be a unique serial # that increments like this (ME-06-001, ME-06-002 etc.) Either the record will have a CRNA # or ME # that is determined by the user. No record can possess both a CRNA # and ME # at the same time. Also, if someone clicks a button and assigns an ME # but then wants to change that to a CRNA #, the ME # that was assigned needs to revert back so that it can be assigned to another record. This way, there are no "missing" ME#'s. Does this help? Thanks
Jscott Posted January 16, 2006 Author Posted January 16, 2006 Your the bomb... Thanks, I really appreciate that!
Jscott Posted January 16, 2006 Author Posted January 16, 2006 Slight problem.... If you have 20 records and you go back to an old record and try to change the number the calculation looks at the number right before it and then adds a number thereby allowing for duplicate numbers to occur. Cas(flag = 0 ;LastMENUMBER; "" ) This calc should look at the last MENUMBER used and then add one from it. What do you think?
Raybaudi Posted January 16, 2006 Posted January 16, 2006 If you have 20 records and you go back to an old record and try to change the number the calculation looks at the number right before it and then adds a number thereby allowing for duplicate numbers to occur. This never occurs if you try to change manually those numbers, but can if you press the "Set Unique" button. So go to change the script (setFlag) to: If[Get ( RecordNumber ) ≠ Get ( TotalRecordCount )] Exit Script Else Set Field[flag;Case(flag=1;0;1)] End If P.S. i changed the attachment to the previous post, too.
Jscott Posted January 16, 2006 Author Posted January 16, 2006 Now the user can only modify the most recent record. How can I adjust this so that if a user makes a mistake and has to go back and change the number from lets say a CRNA# to an ME# that the number becomes the one greater that the last ME# that was assigned? I cannot manually change an old number because it is a calculation. I also need to have to buttons. One that will assign the CRNA# and one to assign the ME#.
Recommended Posts
This topic is 6888 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