wintergreen Posted January 21, 2009 Posted January 21, 2009 I was playing around with FM10 this morning. It looks like the new set field by name script step can be used in conjunction with global variables and script triggers to make a simple "undo/redo" system for data entry. The beauty of this system is that all you need to do is just attach the two trigger scripts to any field. The basic premise is that you store the original field contents in a variable upon entry and then compare the field to that value when it's saved. Any changes are stored in a list along with the table and field name. Undoing a change simply requires reverting to the previous value. See the attached file for details. I've not included a method for "redo" in this file but doing so should be fairly trivial. Also, you'll note that putting a carriage return or a | character in any field will break it. Both of these issues could be addressed with some rudimentary changes to the way the history variable is encoded. undo-redo.fp7.zip
LaRetta Posted January 21, 2009 Posted January 21, 2009 (edited) Way cool! My only initial concern might be record-locking and priority of User change. I just downloaded it and haven't played with it yet but I certainly shall! I think it's great that you are thinking this direction and I commend you for it! Have you ran any multi-user testing on it yet? LaRetta :wink2: Edited January 21, 2009 by Guest
wintergreen Posted January 21, 2009 Author Posted January 21, 2009 haven't done anything with multi-user testing yet. I would expect that in a real system, the undo list would be cleared each time you change layout or switch to a different record, in which case the locking issue should become something of a moot point.
Lee Smith Posted January 21, 2009 Posted January 21, 2009 Hi wintergreen, Also, you'll note that putting a carriage return or a | character in any field will break it. Both of these issues could be addressed with some rudimentary changes to the way the history variable is encoded. When you use your Undo, it adds a paragraph after the change. You might beable to over come your problem, and I was able to get rid of the paragraph added by using the Auto Enter Calculation feature for the fields, and the Custom Function "Trim4" Trim4 ( Self ) HTH Lee
innodat Posted June 4, 2009 Posted June 4, 2009 By the way, there's an easier way to trim the space: just add "Trim 4" to the undo script set field step: Trim4 ( Middle(LeftValues($$history;1);Position($$history;"|";1;1)+1;Length(LeftValues($$history;1) )) ) That way you don't have to create auto enter calcs for all fields - you might want to use that function for other things, like phone number format etc.
innodat Posted December 23, 2009 Posted December 23, 2009 This function works nicely for fields in the current table. But what about field changes in related records? In the sample file, if you add or edit a note, the undo function fails. This is confusing to any user because only "certain" fields will revert. Does anyone have an idea how this could be accomplished?
Recommended Posts
This topic is 5723 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