Subject RE: [IBO] Duplicating rows
Author Helen Borrie (TeamIBO)
At 03:49 PM 04-03-02 +0200, you wrote:
>Sorry, my english must be real bad.
>Usually the users enter data normal way - they press Insert button (the
>generatorlink assigns new ID, GetDocnumber() method in AfterInsert event
>gets called and doc. number is assigned) and everything is fine. Now, once
>in a while they want to get the data from old records and press Duplicate
>{ sRowData=Query.RowData;
> Insert()
> //now AfterInsert event is called - generatorlink assignes new ID and
> doc. number is generated.
> Query->RowData=sRowData // I enter duplicate values which _overwrite_
> previously defined values
> Query->Field("ID")= new value //or key violation will occure
> Query->Field("DOCNO")=GetDocNo();

Yes, but what I'm suggesting is that you don't use GeneratorLinks but
instead call the Gen_ID() method yourself, AFTER Query->RowData=sRowData, i.e.
Query->Field("ID")= Query->Gen_ID(MyIDGenerator, 1)'
Query->Field("DOCNO")=Gen_ID(MyDocNoGenerator, 1);

Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at