Jump to content

Looping through 2-dimensional array based on ascending value of var in dim 2


Mike521

Recommended Posts

Hi all, hopefully I can explain this correctly

 

I have a 2-dimensional array that I need to loop through. dimension 1 may be something like:

 

array( 1, 2, 3, 4, 5)

 

dimension 2 may be something like

 

array1 (1) = array( john, 947 )

array1 (2) = array( mike, 756 )

array1 (3) = array( jim, 1047 )

array1 (4) = array( chris, 999 )

array1 (5) = array( rick, 111 )

 

I need to loop through it all, but not in the order that array 1 presents everything. I need to go in the order of the numbers in array2's second variable.

 

Ideally I would re-sort array 1 in order of array2's second variable, like so:

 

array1 (1) = array( rick, 111 )

array1 (2) = array( mike, 756 )

array1 (3) = array( john, 947 )

array1 (4) = array( chris, 999 )

array1 (5) = array( jim, 1047 )

 

I hope it makes enough sense for someone to help me out! thanks in advance :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.