Undo functionality within an app

Has anybody implemented undo functionality? I have a database application where an undo button would be really nice for the end user. I did some reading about Command Design Pattern, and it honestly doesn’t sound that bad.
I’m hoping someone else has some experience with this…

Would you be able to elaborate a little more on what is trying to be done

1 Like

My application is database heavy. Ignition is automatically gathering information about events via tag events scripts; like, whenever this tag turns on, create a new row in this table with the current timestamp in the ‘start’ column, then populate the current timestamp in the ‘end’ column when it turns off.
My front end Vision application is mostly visualizing this data, but users can input information about these events, as well as modify and delete them. This is where the undo would come in handy; right now, if the user screws up and accidentally deletes something, they are hosed…
Currently, for the most part I simply call project scripts from buttons and things within Vision. From my project scripts, Named Queries are called to do whatever sort of operation needs to be done.

That might be a little tricky. You would have to not delete, but move them somewhere. With some form of priority tracking. and depending on priority move them back.

I haven’t done this, but as @andrews noted, I’d probably move them to another table with additional columns to track who deleted them and when. This could then be used to view/undelete.

Or you could just add these columns to the main table and adjust queries to avoid displaying deleted items when not desired. You could also occasionally prune deleted items by deletion date.

2 Likes

I watched this, I think it makes sense to keep a log of each command that was run for a vision client, as long as I can create an undo function for each function I have. In cases where I’m deleting data, yeah I think you’re right, there would need to be a companion table for each table in my db that would house deleted data. Then the undo delete function is just moving it back into the original table.