Subject AW: [IBO] IB Generators??
Author Kaputnik
You can't use Generators in that way.....
Delphi doesn't know about generators, only Interbase knows them.
Whyt you try to do is to set the Value of a with a function called
GEN_ID, which is not present in Delphi :-)

What you can do is to use a function in the TIB_Connection class, I
think it is called getGenerator or something similar.
As I don't have Delphi installed on this machine just browse through the
CodeInsight-dropdown after typing the name of your
Connection-component....
With this method, IBO will retrieve the generator-value

Hope this helps and
CU, Nick

> -----Ursprungliche Nachricht-----
> Von: Daniel Bertin [mailto:daniel@...]
> Gesendet: Dienstag, 22. Mai 2001 18:11
> An: IBObjects@yahoogroups.com
> Betreff: [IBO] IB Generators??
>
> 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 ;^
>
>
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/