>Hi all,
>
>How can I make a copy of a scattered name object that isn't a reference to the original object?
>
>Eg:
>
>select mytable
>scatter name oData
>oTemp = oData && This only creates a reference. What I need is a copy!
>? oData.name
>> "Justin"
>oData.name = "Bon"
>? oTemp.name
>> "Bon" && This should still be "Justin"
>
>I haven't really got the time to create a proper data class. Any help would be greatly appreciated!
Justin,
I don't know of a direct way. This could help :
function myCloneObject
Lparameters toObject
Local loCopy, lnMembers
Local Array arrMembers[1]
lnMembers=Amembers(arrMembers,toObject)
Local Array arrStruc[lnMembers,4]
For ix=1 To lnMembers
arrStruc[ix,1] = arrMembers[ix]
arrStruc[ix,2] = 'L'
arrStruc[ix,3] = 1
arrStruc[ix,4] = 0
Endfor
Create Cursor dummy From Array arrStruc
Scatter Name loCopy
Use In 'dummy'
For ix = 1 To lnMembers
loCopy.&arrMembers[ix] = toObject.&arrMembers[ix]
Endfor
Return loCopy
Cetin