Subject RE: [IBO] Cachedupdates with insert and edit of multiple rows
Author Svein Erling Tysvær
> >i'm using Tib_Dataset with CachedUpdates and using Buffered View
> >(Dataset buffer).
> >The target is to disconnect the Dataset from database for inserting and
> >editing rows.
> >All is working fine with editing of multiple rows, but i've a problem to
> >edit new inserted row.
> >
> >The steps are:
> >
> >1. load some rows in the buffer and show them. (TIB_Query.open,
> >AutoFetchAll is true, CachedUpdates is true)
> >2. insert new row ( Dataset.append, modify with Dataset.FieldByName )
> >3. modify another row ( Dataset.edit, modify with Dataset.FieldByName)
> >4. modify new row (from step 2) (Dataset.edit, modify with
> >Dataset.FieldByName)
> >5. transfer changes and the new row to database (Dataset.ApplyUpdates
> >and Dataset.CommitUpdates).
> >
> >So, when i'm inserting a new row, it is not possible to modify that (to
> >change to the edit mode is not possible), before inserted row will
> >posted with Dataset.post or Dataset.ApplyChanges.
> >If I'm using Dataset.post, it is possible to change to the edit state
> >and to modify data, but changes (which were made in edit mode) are not
> >be applied to database after ApplyUpdates and CommitUpdates are called.
> >If DataSet.ApplyUpdates will called after new row was inserted, we have
> >same behavior (changes are not be applied to database after ApplyUpdates
> >and CommitUpdates are called).

>> Do you explicitly set the primary key at step 2?

> No, i didn't. it is necessary? I'm using GeneratorLinks for that and it seems to work.

I know that if you've relied on a trigger, then it wouldn't have been enough. I would expect GeneratorLinks to be sufficient, but don't really know enough about the internals of IBO (don't use CachedUpdates myself and don't remember whether the generator is called when you do Append or Post). Since I do think it can be relevant for your question, this reply is sent to both you and the ibobjects list.

Set