You can utilize the “TRANSFERFIELDS” function:
This is what the OnlineHelp tells about the function:
TRANSFERFIELDS (Record)
Use this function to copy all matching fields in one record to another record.
Record.TRANSFERFIELDS(FromRecord [, InitPrimaryKeyFields])
Record
Data type: record
The record to copy the contents of the fields in FromRecord to.
FromRecord
Data type: record
The record from which to copy.
InitPrimaryKeyFields
Data type: Boolean
Default value: True
Comments
TRANSFERFIELDS copies fields based on the Field No. property of the fields. For each field in Record (the destination), the contents of the field with the same Field No. in FromRecord (the source) will be copied, if such a field exists.
The fields must have the same data type for the copying to succeed (text and code are convertible, other types are not.) There must be room for the actual length of the contents of the field to be copied in the field to which it is to be copied. If any of these conditions are not fulfilled, a run-time error will occur.
If the InitPrimaryKeyFields parameter is set to false, the TRANSFERFIELDS function will not change the timestamp or the Primary Key fields of the destination record.
If the InitPrimaryKeyFields parameter is set to true, and the records are in the same table, the TRANSFERFIELDS function will change both the timestamp and the Primary Key fields of the destination record.
If the InitPrimaryKeyFields parameter is set to true, and the records are not in the same table, the TRANSFERFIELDS function will change the Primary Key fields of the destination record (if the fields fulfill the conditions specified above) but the timestamp of the destination record will not be changed.
BLOB Fields
If you are copying a record that contains a BLOB field, you must calculate the BLOB field before it can be copied with the rest of the record.
IF Mytable.BLOB.HASVALUE THEN
Mytable.CALCFIELDS(BLOB);