Here's all the ways you could copy data from a source dbf to a target cursor and you see your way doesn't copy values at all (the final browse of target1 will show the fields as "memo" and "blob", which means these fields are empty, wheeas all other browse windows will show "Memo" and "Blob" signalling these are filled with data,
And that's all to. You need to explicitly copy over the fields of FPTs "again" because you didn't copy them over with a SCATTER without MEMO option. That's all there is to it.
Code:
Create Cursor Source (mytext Memo, mybinary Blob)
Insert Into Source values ('Hello, world!',0he1103071d0)
Create Cursor Target1 (mytext Memo, mybinary Blob)
Create Cursor Target2 (mytext Memo, mybinary Blob)
Create Cursor Target3 (mytext Memo, mybinary Blob)
Create Cursor Target4 (mytext Memo, mybinary Blob)
Create Cursor Target5 (mytext Memo, mybinary Blob)
Create Cursor Target6 (mytext Memo, mybinary Blob)
* copy mechanism as used by you
oSource= 'Source'
oTarget= 'target1'
SELECT &oSource
SCAN
SELECT &oSource
SCATTER MEMVAR
SELECT &oTarget
APPEND BLANK
GATHER MEMVAR
ENDSCAN
* working copy mechanism with scatter/gather
Select Source
Scan
Scatter Memvar Memo
Select Target2
Append Blank
Gather Memvar Memo
EndScan
* working copy mechanism with scatter/gather using record object
Select Source
Scan
Scatter Memo Name oRecord
Select Target3
Append Blank
Gather Memo Name oRecord
EndScan
* working copy mechanism with scatter to record object and insert from object
Select Source
Scan
Scatter Memo Name oRecord
Insert Into Target4 From Name oRecord
EndScan
* working copy mechanism with append
Select Target5
Append From Dbf("source")
* working copy mechanism with insert sql
Insert Into Target6 Select * From source
* looking at the results
For n=1 to 6
cn=Transform(n)
Select Target&cn
Browse Nowait Name BrowseTarget&cn
BrowseTarget&cn..top = (n-1)*100
BrowseTarget&cn..height = 100
BrowseTarget&cn..width = 200
EndFor n
side notes:
1. In a scan endscan loop you don't need to Select the iterated workarea, the endscan does not only skip 1 in the workarea you scan, it als makes it the selected workarea, which is demonstrated in the scan..endscan for Target2 and Target3.
2. You clearly are a legacy fox developer, but have forgotten important facts like how scatter and gather work regarding fpt file related fields, that's the main point.
Set a break poiint after the SCATTER in the Target1 example and see whether the scatter generated variables mytext and myblob. They don't exist! And you can' gather what you didn't even scatter.
3. Instead of Select &namevariable you can do SELECT (namevariable)
4. Even the second shortest form of copying by APPEND is something within the realm of legacy foxpro and you went the scatter/gather route. Why on earth are you doing this so overcomplicated? Also 3 is nothing that was only invented with VISUAL foxpro.
5. I used a source cursor. In case of having a source.dbf the APPEND solution would be written as
APPEND FROM soure.dbf
instead of
Append From Dbf("source")
The DBF() function is only necessary for a cursor source as appending from a dbf file requires the name of the file, not only the name of a workarea that has the file open.
6. The .. in the final loop is not a typo I made 3 times at the same place, one dot is for ending macro substitution and in normal contexts that's optional (like for
Browse Nowait Name BrowseTarget&cn
) and therefore less known, in this context it's absolutely necessary, as the second point is necessasary to address the top,hieght, and width properties. In legacy foxpro you would need arrow notation: &cn.->top, for example. Though I doubt legacy foxpro allowed BROWSE NAME.