Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combining Arrays
Message
De
17/05/1999 14:15:31
 
 
À
17/05/1999 12:51:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00219637
Message ID:
00219703
Vues:
44
>>>>>I might well use this because it's more flexible (if I actually used arrays much anymore :), but how about using AINS, getting loop size from ALEN?
>>>>
>>>>Sure, but I'm pretty certain that, with large arrays at least, the constant redimensioning, AINS() and population of array members would be slower than simply appending into a temporary cursor and spitting out the end result with a SQL Select. And the cursor is certainly easier to sort or filter, too.
>>>
>>>Yes, could be a size issue at some point...well, this goes back to what I was saying last week, I guess, that cursors are more flexible than arrays, and are better for most situations. And if you need to do temporary array manipulation with cursors, why not just use cursors, period? :)
>>
>>'Cause I can't get ADIR() to spit straight into a cursor?
>
>Couldn't you also just use ACOPY? You do have to re-size your destination array to hold all the elements first, but then just tell it where the "new" elements are to start in the array.

I've tried, and this seems to work; obviously, you have to treat everything as a one-dimensional array in ACOPY to get them to match up, and I still think that the cursor solution is better, if for no reason other than it won't break with a large number of rows (if you end up with 13,107 entries, an array can't possibly do it, and that number is reduced further by variables and names currently in use by VFP) and sorting and filtering the set is much easier with the cursor as well:

DIMENSION aFile1[1,5], aFile2[1,5]
nRows1 = ADIR(aFile1,'A*.*')
nRows2 = ADIR(aFile2,'M*.*')
DIMENSION aFile1[nRows1+nRows2,5]
? ACOPY(aFile2,aFile1,1,-1,(nRows1 * 5) + 1)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform