Hi Aimms Community,
I’m having trouble using the Sort function in order to obtain the values of a mulit-dimensional array:
For example:
multi-dimensional array = foo(size,car,color,location)
size, car, color, location = some float value
a ‘small’, ‘toyota’, ‘white’, ‘usa’] = 1.25
‘small’, ‘toyota’, ‘green’, ‘greenland’] = .5
‘small’, ‘nissan’, ‘blue’, ‘france’’] = 1.0
s ‘small’, ‘nissan’, ‘green’, ‘france’’] = .3
In this case we are looking to sort foo by the values for all colors and locations where the size and car are the same, meaning that the result would be put into another variable
bar(size,car,row)
h ‘small’, ‘toyota’, 1] = .5
‘small’, ‘toyota’, 2] = 1.25
a ‘small’, ‘nissan’, 1] = .3
o ‘small’, ‘nissan’, 2] = 1.0
How do I approach this problem? I looked through the documentation but I see that the Sort operator is really trying to sort by an index of an array and not the values for given indexes.
Thanks for any help