Subject | Re: [IBO] How to do a Row Duplicate |
---|---|
Author | Artur Anjos |
Post date | 2001-10-04T07:27:42Z |
Thanks Russel,
But I need this in the client, not in the Server. (I need to provide my users a easy way to create one product very simmilar to the other, for example. Imagine that the product is "Hard Disk XPTO 10Gb" and the user needs to create "Hard Disk XPTO 20Gb", "Hard Disk XPTO 30Gb"). Marcus send me a solution using RowData, but I did not have time to test it. Here he goes:
var
sRowData: String;
begin
sRowData := Qry.Fields.RowData;
Qry.Insert;
Qry.Fields.RowData := sRowData;
Qry.FieldByName( 'PrimaryKey' ).AsInteger := Qry.GeneratorValue(
'Gen_PrimaryKey', 1 );
end;
Artur
But I need this in the client, not in the Server. (I need to provide my users a easy way to create one product very simmilar to the other, for example. Imagine that the product is "Hard Disk XPTO 10Gb" and the user needs to create "Hard Disk XPTO 20Gb", "Hard Disk XPTO 30Gb"). Marcus send me a solution using RowData, but I did not have time to test it. Here he goes:
var
sRowData: String;
begin
sRowData := Qry.Fields.RowData;
Qry.Insert;
Qry.Fields.RowData := sRowData;
Qry.FieldByName( 'PrimaryKey' ).AsInteger := Qry.GeneratorValue(
'Gen_PrimaryKey', 1 );
end;
Artur
----- Original Message -----
From: Russell Belding
Newsgroups: egroups.ibobjects
To: IBObjects@yahoogroups.com
Sent: Thursday, October 04, 2001 8:09 AM
Subject: Re: [IBO] How to do a Row Duplicate
""Artur Anjos"" <arsoft@...> wrote in message
news:001301c14b2a$0d67ca60$0200a8c0@......
> Hy list,
>
> Is there a simple way in IBO to duplicate a row?
>
Suppose you have MyTable with a primary key PriKey and fields Field01,
Field02. An Interbase procedure
MakeNewRow(old_Key integer, new_Key integer)
as
begin
insert into MyTable
SELECT :new_Key, Field01, Field02
from MyTable where PriKey = :old_Key
end
will do what you want.
Regards
Russell
> What I want to do it's let the user select a row, and create a new row
that get's all values from this one, and let the user change that values.
It's like to have a Edit act as a Append/Insert. For now, I'm creating a
temporary buffer with the values from the row, do an Append and copy the
values back.
>
> I wonder if there is a better way, a some kind of flag that we can change
that tells IBO that this will be a new record.
>
> Thanks in advance,
>
> Artur Anjos
> http://www.arsoft.pt
>
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
Yahoo! Groups Sponsor
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]