Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Save an array ... into an array or collection
Message
De
11/02/2011 04:45:25
 
 
À
10/02/2011 20:49:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01499709
Message ID:
01499733
Vues:
66
>I have the following problem.
>
>I have a small cursor for which I want to provide the capability to revert to an earlier version.
>
>Thus, each time I make a change to it, I want to take a snapshot of it, so that I can go back to that snapshot if necessary.
>
>Now, I can select from the cursor into an array (to take the snapshot), and I can append from array to go back to that snapshot if desired.
>
>But, how do I store those arrays that are created each time I make a change? I thought of having a collection, but I don't know how to save an array into a collection. I thought of an array, but I can't save an array as an element in an array?
>
>Any suggestions?
>
>Thanks
&& (1) You create an empty object 
obj = createobject('empty')

&& (2) figure out the dimensions of the array using alen(..,1) and alen(..,2)
&& and construct a string like this, say
arrayDef = 'aa[20,2]'

&& (3) add the array to the empty object
=addproperty(m.obj, m.arrayDef)

&& (4) Copy the array to the object
=acopy(sourcearray, obj.aa)

&& (5) add obj to the collection
=collectionObject.Add(m.obj)
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform