Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Dimension to resize an array
Message
 
 
To
11/01/2006 08:55:48
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01085313
Message ID:
01085593
Views:
13
Hi Mike,
My case if very simple. I have to retrieve a bunch of XML files from a folder on the disk and process them in a certain order (by file name + suffix).

The file name format is as follows "DDMMYYYY_##.XML". The ## in the file name is as follows: "1", "2",... "10", "11", etc. So to process the files in the order by the ##, I have to pad the ## with "0". So what I will do, once I get the array of file names, create a new array and copy the file name from the original array to the newly created array, at the same time padding the ## with "0". Then I can ASORT() the new array and process the files in the correct order.


>Hi Dmitry
>
>What are you using an array for? A cursor often can be used instead.
>
>>Hilmar,
>>I actually am using your approach 2 (even though you marked it with "yech" <g>.)
>>This is probably one thing that I miss from Clipper (which is how I thought arrays should work) as compared to VFP arrays.
>>
>>Thank you for your input.
>>
>>
>>>
>>>As explained in other replies you got, the array is, unfortunately, treated as a one-dimensional structure; the two dimensions are just a convenient way to access it. But in the case of redimensioning, you are in trouble.
>>>
>>>Some options:
>>>
>>>
  • Give the array sufficient columns in the first place.
    >>>
  • To redimension, copy to another array (yech!).
    >>>
  • Use my "large array" class from the download section, instead of normal arrays. Accessing the array elements is slower than with built-in arrays, but redimensioning is no problem. Also, you can have more than 2 dimensions in your array.
    "The creative process is nothing but a series of crises." Isaac Bashevis Singer
    "My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
    "If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
  • Previous
    Next
    Reply
    Map
    View

    Click here to load this message in the networking platform