Subject Re: [IBO] Duplicate a record
Author Jason Wharton
How about if I created an Assign() method of the TIB_Row that would transfer
values for rows names that match up and null the others that didn't match
up?

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Harald Klomann" <nibler@...>
To: <IBObjects@egroups.com>
Sent: Monday, November 20, 2000 7:46 AM
Subject: Re: [IBO] Duplicate a record


> Thanks, this is much better !
>
> Harald
>
>
>
> Chef wrote:
>
> > Harald,
> >
> > just a suggestion, I use "RowData" for this task:
> >
> > procedure TM_DM_PlannerCfg.DuplicatePlanCol( ID_PlanCol: Integer );
> > var
> > sRowData: String;
> > begin
> > with Qry_PlanCol do begin
> > Locate( 'PC_ID_PLANCOL', ID_PlanCol, [] );
> > sRowData := Fields[0].Row.RowData;
> > Insert;
> > Fields[0].Row.RowData := sRowData;
> > FieldByName( 'PC_ID_PLANCOL' ).AsInteger := GeneratorValue(
> > 'GEN_PC_ID_PLANCOL', 1 );
> > Post;
> > end; // with
> > end;
> >
> > HTH,
> > Markus
> >
> > At 15:13 20.11.00 +0100, you wrote:
> > >Hi,
> > >
> > >I want to append a new record, with the all the values assigned from
the
> > >current record in a grid.
> > >My code works, but is there a better method to do this ?
> > >
> > >
> > >procedure TfrmDemo.Button1Click(Sender: TObject);
> > >var i:integer;
> > >begin
> > > with IB_Query1 do begin
> > > i := FieldByName('ID').AsInteger;
> > > Append;
> > > KeyFields.ByName('ID').AsInteger := i;
> > > if LookupKeyForBufferFields then begin
> > > for i := 0 to FieldCount-1 do
Fields[i].Assign(BufferFields[i]);
> > > post
> > > end;
> > > end;
> > >end;
> > >
> > >
> > >Thanks
> > >Harald Klomann
> >
>
>
>
>
>