Insert data in steps

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
piopio1
Posts: 32
Joined: Thu 10 Jan 2013 23:13

Insert data in steps

Post by piopio1 » Fri 01 Feb 2013 12:35

Hello,

I have a problem managing two tables with CachedUpdates=true
The first table holds the main data and the second table contains further details and it is linked to the first via master-detail link.

The user can add/modify/delete data in three steps: in the first step he operates on the records of the first table only; then the application checks if the data is consistent, if so it proposes the user to fill the further details to be saved in the second table. If everything is ok for this data too then the buttons save/cancel are shown.

The user can complete the first step, go to the second and the third and finally click on save or he can decide to go back and forth among the steps if any amendments are necessary before saving.
In order to do so I decided to set CachedUpdates =true, to use ApplyUpdates to validate the steps and play with Savepoint and RollbacktoSavePoint to go back to the previous step. Unfortunately this doesn’t work for me; it seems I can save only one Savepoint per time and in some cases the form shows inconsistent data too.


Is this the right approach to the problem or you can propose a better one ?


Many thanks
Pio Pio

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Insert data in steps

Post by AlexP » Mon 04 Feb 2013 12:56

Hello,

To undo the last operation in the cached updates mode, you can use the RevertRecord method. At every call of this method, all edits of DataSet will be sequentially undone. A sample of RevertRecord work can be found in our demos - the CachedUpdates section.

Post Reply