Jump to content
Server Maintenance This Week. ×

This topic is 5238 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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

Link to comment
Share on other sites

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 by Guest
Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 4 months later...

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.

Link to comment
Share on other sites

  • 6 months later...

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?

Link to comment
Share on other sites

This topic is 5238 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.