Subject Re: Generator problem
Author mk_delphi
This simple trigger work fine for mine low users network..
Place this is in AfterPost event:

declare variable LST integer;
select max(number)+1 from header_table
where extract(year from docdate)=extract(year from new.docdate)
into :LST;
if ((LST is null) or (LST=0)) then
update header_table set number=:LST where oid=new.oid;

Since I always close transacion after this post, never
appens a concurrency....(of corse in a little network)
NB: if the records are a lot using a desc
index on "number" will help.

Can someone own better solution than this?
(without the use of named generator...)

--- In ib-support@y..., "wvlange" <willem.van.langendonck@c...> wrote:
> I have the following problem for which I want a solution in FB 1.0
> I have an application that produces documents that are numbered per
> year. So I want to have number ranges per year. For every number
> range I defined a generator.
> Now I want to write a trigger that will give the correct document
> number based on the date of the document that is posted. Does
> have a suggestion on how this can be done ?