Subject | Re: How to duplicate a row from edit state into append/insert state? |
---|---|
Author | tibotaka |
Post date | 2006-03-14T14:36:07Z |
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
-> 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
>are some
> My application has a form containing the fields of a data row like
> "select * from partlist where ref=1234" (ref is primary key, there
> other fields, which are indexed and defined as unique as well).row
>
> Now I'd like to give the customer a function to duplicate the actual
> (leaving the old one intact) into a new row (insert or append).let the user
> Then I'll change some of the unique fields in the application and
> edit the row.on the
> 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
> oldrow, although the append has been done?