Donnie Posted June 17, 2005 Posted June 17, 2005 I have a field set as a button, so that when a user clicks on that field to edit it, it will run a script to compare Today to the Modified Date. If they choose that they still want to edit it, it will enter that field. Problem is, I need a script for every field on the layout. This isn't a problem, just real time consuming. Is there a universal way to get to the specific field that they clicked on? Here is my code: If [Modified Date <> Today or ""] Show Message [buttons: "Edit Record", "Cancel", "";Data:"This is an existing MWR. Do you wish to Edit this record?"] If [status( CurrentMessageChoice) = 1] Show Message [buttons: "OK", "", "";Data: "You have chosen to edit this record. you may now continue."] Set Field [Modified Date, Today] Go To Field [Test] End If Else Go to Field [Test] End If I would like to get rid of the "Go to Field - Test" as that is what would change on all of the scripts. Any suggestions? Thanks.
Raybaudi Posted June 17, 2005 Posted June 17, 2005 Yes, I have a suggestion... but I'm Italian and My English isn't so good! I suggest you the TopTip in the Tips Forum, but it was written for .fp7. I know it works with .fp5 too.
Donnie Posted June 17, 2005 Author Posted June 17, 2005 I'm looking it over, but honestly I'm a newbie, and I'm trying to decide if this will work for me or not, and if so, how to convert it to mine.
LaRetta Posted June 17, 2005 Posted June 17, 2005 Hi Donnie, No, no suggestions, because I'm unsure why you are using this process. If a User accidently TABS to the field, your script will not fire. If they modify the record, and you have a field (date) called Modification Date set to Auto-Enter, you can select 'Modification Date'. Every time they change the record, this date will change without need of script. This is ONE exception to the regular rule (in versions less than 7) which enters data (with Auto-Enter) ONLY upon record creation. Modification Date will always change to the current date anyway. This Modification Date behavior is what is replicated in vs. 7 when using Auto-Enter (unclick Do Not Replace Existing Value); which can now be applied to all standard fields within a table. Whatever you are attempting to do (notify Users that this record has already been changed on the current date?) might be better addressed in other ways: Use script to compare Modification Date to current date BEFORE layout switch and ask your question then. Only if their answer is yes, switch them to layout in which they can modify all fields freely. Or even ... just place a large red calculation (text, unstored) at the top of the layout. It could be something like: If(ModificationDate = Status(CurrentDate); "This record has already been changed today.") LaRetta
Raybaudi Posted June 17, 2005 Posted June 17, 2005 ok, i'll try to explain, but it will be better if someone else explain to you. 1) make a calculated number field: Status(CurrentRecordNumber) 2) make a self-relationship by that field 3) make a portal of one line 4) put one field (as Test) inside the portal and make it not accessible to write 5) make the field a button 6) link this script to that field: If [Modified Date <> Today] Show Message [buttons: "Edit Record", "Cancel", "";Data:"This is an existing MWR. Do you wish to Edit this record?"] If [status( CurrentMessageChoice) = 1] Set Field [Modified Date, Today] go to portal row [first] Set field[] End if else go to portal row [first] Set field[] End if 7) Repeat 3) 4) 5) and 6) for all your fields.
Raybaudi Posted June 17, 2005 Posted June 17, 2005 note that the set field[] don't know which field you clicked, but the cursor will be inside the right field !! This is why I named it the TopTip
Recommended Posts
This topic is 7101 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