wwUtils::ArrayToCollection

Convert a FoxPro array to a Collection.

Useful in scenarios where you need to return a 'collection' result but you only have access to an array. Arrays can't be passed from methods and don't pass well over COM, so they work badly in multi-tier environments for serialization or for passing to external applications. Collections are more flexible and this function makes it easy to convert arrays to something more usable.

DIMENSION laArray[100] 
FOR lnX =1 TO 100
   laArray[lnX ] = TRANSFORM(lnX)
ENDFOR

loCol = ArrayToCollection(@laArray)
? loCol.Count  && 100
o.ArrayToCollection(@laArray,lnMode)

Return Value

Collection is always returned even if empty. If a non-array is passed an error occurs.

Parameters

@laArray
Array to convert

lnMode
0 - (default) Collection 2 - wwCollection


See also:

Class wwUtils | wwUtils::CollectionToArray

© West Wind Technologies, 2023 • Updated: 05/31/21
Comment or report problem with topic