Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Save an array ... into an array or collection
Message
From
10/02/2011 22:19:27
 
 
To
10/02/2011 21:37:20
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01499709
Message ID:
01499714
Views:
66
untested
local laCursor, loE, lcP
select * from myCursor into array laCursor
loE = creatobject("empty")
lcP = "acopy_" + dtos(datetime())
= addproperty(loe, lcP)
= acopy(laCursor, loE.&lcP)

or

loE = creatobject("empty")
lcP = "acopy_" + dtos(datetime()) + "[2,2]" 
= addproperty(loe, lcP)
select * from myCursor into array  loE.&lcP
and store either the object in a collection or create a time based naming schema, check via amembers or perhaps use the ability to save a whole array into a memofield of a table or cursor, having a datetime field and another memo for search critereria, which is sometimes better for debugging and esp. if you have to persist the data.

regards

thomas



>Well --
>
>I was hoping for a way to save the entire cursor each time, not just the changed records.
>
>And I was hoping there was some nice way to do so without actually iterating through all the fields and records.
>
>I can't seem to do it with any of the array functions, I'm gonna see if using XML could be the way to go.
>
>
>>Create an variable and assign it to an instance of an "empty" class. Now you can add properties to the object for each field. You could use AFIELDS to get an array of the fields and then add as a property to the object. Now you can save the values to the object; and in turn save the object to a collection.
>>
>>
>>loInstance = CREATEOBJECT("EMPTY")
>>lnNumFlds = AFIELDS(laFields,"cursor_alias")
>>FOR lnNdx=1 TO lnNumFlds
>>    ADDPROPERTY(loInstance, laFields[lnNdx,1], "")
>>ENDFOR
>>
>>
>>Now you have your Instance object which can store the values. You would then save it to the collection and reset the values for the next record to save.
Previous
Reply
Map
View

Click here to load this message in the networking platform