Subject RE: [IBO] Sync an inserted record with ID provided by a SP, any trick?
Author Brian K. Woods
Marco,

> I have a query that returns a left joined dataset and uses a stored
> procedure in the EditSQL.
> This is because the join creates an "empty table" that in IB_Grid I
> can fill, and the stored procedure checks if the primary_id is not
> null, then it's an update, otherwise it's an edit.
> The problem is that I can't get the primary_id in advance as usual,
> but since I need the buffer to be synchronized after the edit
> (SyncAfterEdit) and if I "edit" an empty row I've no primary key to do
> the sync, I'm in troubles :(
> Is there any property/trick to add to my stored procedure the

I had a similar problem to overcome - don't know if you can use what I did
or
not, but here it is. Your edit sp needs the null value to distinguish
between
edit/insert, right? What if you had a negative key value to indicate
inserts?
By default, generators start with a value of zero, so if you didn't change
it when
you created the database, then every generated key in your db should
positive, right?
So, just create a dummy _reverse_ generator in your db. Don't let IBO's
generatorlink fetch its values.
Instead, fetch values from it yourself, passing a -1 for the increment
parameter.
Then, when your sp sees the negative value, it can fetch a "real" generator
value for the
new record, just as it currently does when it sees null keys.

Just an idea...
HTH,
Brian