Hello Harvey,
I don't know, database 1 the same structure like database 2 ???
( You can replace fields with equal fieldnames )
You can create a function like :
- Code: Select all Expand view
FUNCTION Rec_Copy ()
LOCAL FX, VALUES := {}
// read a record from Database 1
// -----------------------------------
DBSELECTAREA(1)
FOR FX := 1 TO FCOUNT() // Fields --> Arrray
AADD(VALUES, FIELDGET(FX))
NEXT
...
...
// copy the array to Database 2
DBSELECTAREA(2)
// jump to a defined record, append new or seek a value from database 1
// RECORD-LOCK needed !!!
// write the fields like :
// ---------------------------
FOR FX := 1 TO FCOUNT() // Array --> Fields
FIELDPUT(FX, VALUES[FX])
NEXT
RETURN NIL
Maybe You still need more Infos : FIELDPOS() and FIELDNAME() ?
Sample 1
USE Customer NEW
? FIELDPOS( "Name" ) // Result : 1
? FIELDGET( FIELDPOS( "Name" ) // Result : "James"
Sample 2
USE Customer NEW
USE Invoices NEW
? Customer ->( FIELDPOS( "Name" ) ) // Result : 1
? Customer ->( FIELDGET( FIELDPOS( "Name" ) ) ) // Result : "James"
Sample 3
USE Sales
? Sales->( FIELDNAME( 1 ) ) // Result : Branch
Sample 4
USE Customer NEW
? FIELDGET( 1 ) // Result : "James" ( of selected record-position, Field No. 1 = Name )
Sample 5
USE Customer NEW
? FIELDPUT( 1, "James" ) // Result : Field No. 1 = Name of selected record-position is replaced with "James"
I hope it helps
Best Regards
Uwe