Re: TZF - Copy a record to virtual file
Philip Kidder <[email protected]> Thu, 14 Aug 2003 09:46:04 -0400
| Newsgroups | gmane.comp.lang.delphi.topaz |
|---|---|
| Message-ID | <[email protected]> |
Pierre,
Look at the AssignUserPointer method.
You said that both databases have the same structure so you need to create only one type statement defining the structure of a Customer record. Then define two pointers one for the customer database (CustomerPtr) and one for the virtual database (VCustomerPtr). Use the AssignUserPtr method to initialize the pointer to their corresponding databases. Then VCustomerPtr^ := CustomerPtr^ should copy the record to the virtual databases record structure. Finally you need to do an append in the virtual database.
The code would look something like this:
type
Customer_Record = record
_Deleted : boolean;
First_Name : string[20];
Last_Name : string [20];
.
.
.
end;
var
CustomerPtr : ^Customer_Record;
VCustomerPtr : ^Customer_Record;
begin
Customer.AssignUserPtr (CustomerPtr);
VCustomer.AssignUserPtr (VCustomerPtr);
{ find the record to copy to the virtual database }
VCustomerPtr^ := CustomerPtr^;
VCustomer.Append;
Give this a try.
Phil Kidder
----- Original Message -----
From: Pierre Wittwer
To: [email protected]
Sent: Thursday, August 14, 2003 8:31 AM
Subject: Re: TZF - Copy a record to virtual file
Hi
With the appendFrom you only can append the whole or a filtered Database.
My goal is to copy only one Record.
Other suggestions ?
Thanks Pierre
> > I want to copy a record from e.g. customerDbf to a virtual file
> > VirtualDbf with the same structure.
> > I did it so, that I copy each field from one file to the other
> > VirtualDbf.Set x Fild('FIELD', customer.GetSet x Field );
> >
> > is there another possibility to copy the record directly ?
>
Yes. Use the loadfromDBF option of the Vfile.
Also you can look to appenfrom (am not sure TzVFile supports it)
> > Pierre Wittwer
> > 6370 Stans
> >
>
> Benno
>
>
>
>
>
--^----------------------------------------------------------------
This email was sent to: [email protected]
EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5jPZj.cG1raWRk
Or send an email to: [email protected]
TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
--^----------------------------------------------------------------
--^----------------------------------------------------------------
This email was sent to: [email protected]
EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]
TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
--^----------------------------------------------------------------