Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Easy way to store values to array elements
Message
From
21/03/2009 21:05:34
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
21/03/2009 20:51:36
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01390324
Message ID:
01390327
Views:
66
>Hi all.
>I have a fixed idea that exist an 'easy' way to store values to the
>various elements of an array instead of creating many lines
>referring the index of row,col. I don't know if this come from CLIPPER
>time or if exist in FoxPro/VFPRO. So please elucidate me.
>The idea hammering my head is that you can store values in this way
>(or something similar):
>
>&& Creating a two dimensional array with 3 rows and storing strings to the elements
>myArray = {{'Value 1','Value 2'}, {'Value 3', 'Value 4'}, {'Value 5','Value 6'}}
>
Not Fox. Javascript, Python, probably many others.

In Fox, if you really want to store a lot of values into an array, you can maybe arrange them in a cursor (which you'd store as XML) and then select into array, or (what I sometimes do)
text to lcA noconsole
value1, value2
value3, value4
value5, value6
endtext
n=alines(aRows, lcA)
dime myA(n,2)
for i=1 to n
   myA[i,1]=getwordnum(aRows, 1, ", ")
   myA[i,2]=getwordnum(aRows, 2, ", ")
endfor
As you see, it isn't that long (I didn't mind typing it :), and the nice part is that you can edit the list at will, including any way to sort it (often I get those lists from somewhere using _Vfp.datatoclip(,,3) and then paste them into code). Sometimes the delimiter is a comma, sometimes a tab, sometimes there's a column of numbers - it depends, but the principle is the same.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform