Merging Arrays to a fixed size (OpenInsight 16-Bit Specific)
At 12 DEC 2002 06:42:00AM Michael Norton wrote:
Is there a function in OI where I can merge a number of arrays into 1 fixed size array.
my example: I have 3 arrays current, obsolete and extinct, each array can have any number of attributes. I want to merge the arrays in the order listed but only to a limit of 100 attributes say. Is there a method available to do this without using loops.
Many thanks
At 12 DEC 2002 07:28AM Oystein Reigem wrote:
Michael,
If you want to merge them that implies your arrays are sorted, say
Array1=Ann" : @FM : "Brenda" : @FM : "Charlie" : @FM : … Array2=Abe" : @FM : "Arthur" : @FM : "Bo" : @FM : … Array3=Aaron" : @FM : "Ada" : @FM : "Ben" : @FM : …
So if you string them together:
Array=Array1 : @FM : Array2 : @FM : Array3
…and sort the result with V119:
convert @FM…etc… to @RM…etc… in Array Array := @RM V119( "S", "", "A", "L", Array, "" ) convert @RM…etc… to @FM…etc… in Array …etc…
…and then extract the first 100 elements:
Array=field( Array, @FM, 1, 100 )
…you have reached your goal.
Except if your arrays contain duplicate elements that you don't want included in the result (e.g, both Array1 and Array2 contain "David"). Then you need to do the loop thing.
- Oystein -