I am trying to understand the proper methodology of undoing (canceling) changes to records in a form base on a set, including canceling new records. When I say records, I am referring to the complete form, including all the data from all the tables. If I want to give the user the option of saving or canceling before moving to the next record or closing the form, I can do it just fine in a form based on a single table by using the following code in the 'CanSave' and 'CanExit' events.
Alpha's help file says:
But this code does not work for a form base on a set. Alpha saves (commits) the changes to the table for each table affected as you move around on the form. So, what is the proper method of canceling...
I'll use Alpha Sports for an example...
Open up Alpha Sports and open the invoice form,
on any existing invoice; add/change a credit card number in the credit card field,
then move down and add a line item to the invoice,
then move up and edit the price on an existing line item...
... now cancel all of the above... how do I do it?
Thanks, Dan
Code:
dim vMode as C vMode = parentform.Mode_Get() if vMode <> "VIEW" then dim vAns as N vAns = msgbox("Save?","You have made changes, do you want to save them before leaving?",UI_ATTENTION_SYMBOL+UI_FIRST_BUTTON_DEFAULT+UI_YES_NO_CANCEL) if vAns = UI_YES_SELECTED then 'Yes selected, 'do nothing, record saved automatically elseif vAns = UI_NO_SELECTED then 'No selected topparent.cancel(.t.) elseif vAns = UI_CANCEL_SELECTED then 'Cancel selected cancel() end if end if end if
In almost every case, Alpha Five treats sets exactly like tables. You can create layouts and perform and save operations for a set. When entering data into a form designed for a set, the information is automatically placed into the correct table along with the necessary linking information.
I'll use Alpha Sports for an example...
Open up Alpha Sports and open the invoice form,
on any existing invoice; add/change a credit card number in the credit card field,
then move down and add a line item to the invoice,
then move up and edit the price on an existing line item...
... now cancel all of the above... how do I do it?
Thanks, Dan
Comment