Alpha DevCon 2018
Results 1 to 11 of 11

Thread: Undo update

  1. #1
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default Undo update

    I have a client with a button that prompts the user for a po # and a date shipped, the table is opened, filtered based on the po # entered by the user, and the date_out field is updated with the date shipped that the user entered.

    They would now like an Undo button that would put the records back to where they were prior to running the update. Any ideas on what would be the most efficient way to accomplish this task?

    Thanks
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,954

    Default

    Quote Originally Posted by Cheryl Lemire
    I have a client with a button that prompts the user for a po # and a date shipped, the table is opened, filtered based on the po # entered by the user, and the date_out field is updated with the date shipped that the user entered.

    They would now like an Undo button that would put the records back to where they were prior to running the update. Any ideas on what would be the most efficient way to accomplish this task?

    Thanks
    I'm assuming that they update records as shipped more than once a day so that you can't just have another button with the same coding that updates the date_out field to {} - empty date?

  3. #3
    Member John Gamble's Avatar
    Real Name
    John Gamble
    Join Date
    Jan 2001
    Location
    Newmarket, ON Canada
    Posts
    886

    Default

    Cheryl

    Begs the question, can they ship the same unit more than once. Because you did'nt mention a quantity perhaps this is a one time only. If so an update to blank x date would do it.

    But somehow I think you know that, so I'll assume multiple ships are possible. If so than perhaps a transaction file by date could be kept for the purpose of backing out the ttransactions.

    John

  4. #4
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default

    You assume correctly Stan. What they want the undo button to accomplish is to undo the last run update.
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

  5. #5
    "Certified" Alphaholic
    Real Name
    Ohlen Cartmell
    Join Date
    Apr 2000
    Posts
    1,599

    Default

    Cheryl,
    Is this on a per record basis or on a per table basis? IOW do they want to only back out the update to a record or does the entire table need to be "un-updated"?

  6. #6
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default

    John,

    As I understand it, the po cannot be shipped unless it is complete, so the po # would only be shipped one time.

    I need to somehow store the last po # entered by the user and when they click the undo button it finds the last updated po# and then blanks out the ship_out field for all of the matching records.

    The value is in a variable, however, I am not sure how that works if they run the update at the end of the day, and it is the next day before they realize they made a mistake.

    Perhaps I could add some fields to the table that marks the date/time that the date_out field was last updated that only get populated via the update script. Then I could pull the most recent date/time and blank out those date_out fields?

    Not sure this is the most efficient way or if there are even easier ways to accomplish the task.
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

  7. #7
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default

    Ohlen,

    This is on a per table basis. The PO # can appear in the table many times with multiple line items. When the update runs, it updates the date_out field for multiple records in the table that match the PO #.

    I also thought about changing the update script to mark the records either before/after the update runs based on the filter. But I am not sure what to do in the update and then the undo, or if this would even work since records may get marked elsewhere in the application.
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

  8. #8
    Member John Gamble's Avatar
    Real Name
    John Gamble
    Join Date
    Jan 2001
    Location
    Newmarket, ON Canada
    Posts
    886

    Default

    Cheryl

    You mentioned that the user may not recognize the need to undo, until later.
    Given that, would the last PO updated not be redundant? Many po's may have been processed in the interim.

    How about a button to undo, which simply requests the PO # and blanks all date_out fields in the child records. I can't see any way you could programmatically determine what po needs updating unless it was the previous one.

    John

  9. #9
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default

    John,

    I believe what they are looking for is to update the last po that was updated. I just emailed my client with concerns about blanking out the date field based on the last update.

    Let me ask this, if I get the client to agree to it, when the user presses the undo button, I load an xdialog that is autofilled with the last po # giving the 'proceed with undo' button focus ...... how would I programmatically fill that field with the last value?
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

  10. #10
    Member John Gamble's Avatar
    Real Name
    John Gamble
    Join Date
    Jan 2001
    Location
    Newmarket, ON Canada
    Posts
    886

    Default

    Cheryl

    Quick & Dirty

    Assume
    1. The application will NOT be shut down prior to this undo being run.
    2. Units are protected by UPS's.
    3. If more than one person is updating po's it is the last po updated vs. the last po THIS person has updated.
    4. This is NOT a CRITICAL requirement but a convenient one.

    Last step in updating a po is to update a variable Var->Last_Po.
    If undo is required:
    Xdialog box as you suggested to display Var->Last_Po
    Proceed ?
    Undo

    Not real comfortable with this as I suspect timing, transaction volume etc. could prove a major bug-a-boo.

    ELSE (preferred)

    Set up a transaction file (or use A5's built in audit file !) to track the last update.

    xdialog to display trans record (descending date & time seq)
    ? proceed
    Undo

    This would allow the user to select a different po, might be required due to above concerns. Sure the user has really thought this out?

    Might this work for you.

    John

    PS. If more than one person is entering, suggest a panic alarm to alert all users not to process any po updates or the last po # won't be the right one. TIMING !!
    Last edited by John Gamble; 05-08-2006 at 05:25 PM.

  11. #11
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default

    Thanks for the input John. It appears that the global update is doing more than I had originally anticipated. I will be having a conference with my client later this week to get further clarification of exactly what is needed, so consider this thread closed.

    Thanks to all for your thoughts and input. These will be helpful when speaking with my client.
    Cheryl
    #1 Designs By Pagecrazy
    http://pagecrazy.com/

Similar Threads

  1. Posting – Undo on Delete via Set?
    By Daniel Weiss in forum Alpha Five Version 4
    Replies: 17
    Last Post: 05-08-2007, 10:30 PM
  2. Bug in Form design Undo
    By Mario Prieto in forum Alpha Five Version 6
    Replies: 3
    Last Post: 10-18-2005, 03:32 PM
  3. Posting - Undo on Delete
    By Steve Wood in forum Alpha Five Version 6
    Replies: 2
    Last Post: 02-07-2005, 03:47 PM
  4. UnDo A Really Neat Feature
    By forskare in forum Alpha Five Version 5
    Replies: 4
    Last Post: 12-21-2002, 07:04 AM
  5. Undo Database Compact?
    By Wayne Hanlon in forum Alpha Five Version 1
    Replies: 2
    Last Post: 10-25-2000, 10:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •