I need to allow my users to review a series of records. Depending on which exit button they use any changes to those records during the review should be either accepted or rolled back to their original condition.
Intuitively I sense the function databaseManager.commitTransaction() would possibly play a roll, but I’m not sure. Up until now in this sense Servoy has behaved much like FMP – move from field to field and have any changes immediately saved to disk (or at least this seems to be what’s happening).
This is very unfamiliar territory for me. Would appreciate some guidance from more experienced hands.
Morley:
I need to allow my users to review a series of records. Depending on which exit button they use any changes to those records during the review should be either accepted or rolled back to their original condition.
Intuitively I sense the function databaseManager.commitTransaction() would possibly play a roll, but I’m not sure. Up until now in this sense Servoy has behaved much like FMP – move from field to field and have any changes immediately saved to disk (or at least this seems to be what’s happening).
This is very unfamiliar territory for me. Would appreciate some guidance from more experienced hands.
I started using transactions only recently, but I found them extremely useful and absolutely clear.
I currently use the transactions when editing single records, but I think that you can build a system that starts a transactions when you get the list of records and commits or rollbacks when the user leaves the list view (if it’s your case).
transactions are exactly the solution you need, but be aware that not all back ends support them.
You can find the following thread interesting if you have portals on your forms when using transactions: http://forum.servoy.com/viewtopic.php?t=2916
Call this function at the start – databaseManager.startTransaction
Call this function to store any changes the user has made to the records and end the “transaction” – databaseManager.commitTransaction
Call this function to rollback whatever changes the user has made and end the “transaction” – rollbackTransaction.
Is there a way to tell whether the user has made any changes to records since the Transaction was started? I’d like to get a confirmation to accept changes from the user, if there has indeed been some changes.
The docs are sparse in this area and this is totally unfamiliar territory.
On what is probably a related subject, what do Locks do, as in acquireLock, hasLocks, releaseAllLocks?