Subject Re: How to duplicate a row from edit state into append/insert state?
Author tibotaka
In my opinion "normal" process flow is BROWSE -> APPEND/INSERT or EDIT
-> POST/CANCEL -> APPEND/INSERT...

You can try something like this:

procedure TForm1.Button2Click(Sender: TObject);
var
SpareRowValues: Variant;
begin
SpareRowValues :=
ib_query1['NAME;ADDRESS;ZIP;CITY_NAME;...;STATE_NAME'];

{'NAME;ADDRESS;ZIP;CITY_NAME;...;STATE_NAME' is list (delimited with
;) of fields you want to copy to new record}


ib_query1.append;
ib_query1['NAME;ADDRESS;ZIP;CITY_NAME;...;STATE_NAME'] :=
SpareRowValues;
...
end;

so You have to get "spare" values You want to copy BEFORE append/insert.

Hope this helps...

tibotaka

>
> My application has a form containing the fields of a data row like
> "select * from partlist where ref=1234" (ref is primary key, there
are some
> other fields, which are indexed and defined as unique as well).
>
> Now I'd like to give the customer a function to duplicate the actual
row
> (leaving the old one intact) into a new row (insert or append).
> Then I'll change some of the unique fields in the application and
let the user
> edit the row.
> Finally the user can choose to commit/store the new row or drop the new
> row.
> Any idea how to do that?
> I've tried something like this:
>
> procedure TForm1.Button2Click(Sender: TObject);
> VAR I : Integer;
> OldRow : TIB_Row;
> begin
> AlteRow:=ib_query1.Fields;
> IB_Query1.Append;
> for I:=0 to IB_Query1.FieldCount-1 do
> Begin
> IB_Query1.Fields.Columns[i].Value:=OldRow.Columns[i].Value;
> End;
>
> But this is only copying NULL values. How can I get a pointer valid
on the
> oldrow, although the append has been done?