Subject IB Generators??
Author Daniel Bertin
Hi all,

I know this may seem silly but, i'm doing this conversion and I have this
problem.

I created a generator, and then an insert trigger, am I able to use this to
update another field in the table without messing up the counter? if yes how?

would like to update a field and keep the counter correct. presently I am
doing it like this.

datamodule1.IBOtable1.fieldbyname('dispno').asinteger :=
form2.wwtable3.fieldbyname('dispno').asinteger
+ 1;

I tried this but get an error undeclared identifier 'GEN_ID'.

datamodule1.IBOtable1.fieldbyname('dispno').asinteger :=
GEN_ID("GEN_DISP_LEG_DISPNO",1);


Help someone please.
Thanks
Daniel

/* Generators to AutoInc fields for table "disp_leg" */
CREATE GENERATOR "GEN_DISP_LEG_DISPNO";
SET GENERATOR "GEN_DISP_LEG_DISPNO" TO 1;
CREATE GENERATOR "GEN_DISP_LEG_UNIID";
SET GENERATOR "GEN_DISP_LEG_UNIID" TO 1;

SET TERM ^;
CREATE TRIGGER "TRIG_DISP_LEG_BI" FOR "DISP_LEG" BEFORE INSERT
AS BEGIN
IF(NEW."DISPNO" IS NULL) THEN NEW."DISPNO" =
GEN_ID("GEN_DISP_LEG_DISPNO",1);
IF(NEW."UNIID" IS NULL) THEN NEW."UNIID" = GEN_ID("GEN_DISP_LEG_UNIID",1);
END ^
SET TERM ;^