Subject Re: [IBO] Determine table's key value after post
Author Helen Borrie
At 09:31 PM 7/05/2005 +0200, you wrote:
>I'm using an IBODatabase and IBOQuery components in an IntraWeb
>application interfacing with a FireBird database. I'm using a Generator
>and a Triger to generate the keys of the table. What is the best way to
>get hold of the generated key value in the AfterPost event of the IBOQuery?

There is no way to get it *after* the post. The trick is to get it
*before*, using GeneratorLinks.

Write the trigger in such a way that it will only fire if no value is
passed to it, i.e.

create trigger xx for yy active before insert
as
begin
if (new.ID is null) then
new.ID = gen_id(gen_yy, 1);
end

Then, in your IBOQuery, set GeneratorLinks:

ID=GEN_YY

or set it globally in the GeneratorLinks property of your connection object:

YY.ID=GEN_YY

You can read the value into a variable in the BeforePost event.

Helen