Sorting multi-dimensional arrays

I can sort an array using the arraysort function but I can only sort one dimension at a time. How can I sort two rows of my array in parallel such that only the first row is sorted by its content and the second is sorted according to the changes in the first row?
lazarus005Asked:
Who is Participating?
 
brownlarConnect With a Mentor Commented:
For this approach, you may want to write your own "sort" tag.

If I understand what you're asking, consider using a "3rd" array as and "index" array.  The 3rd array field values are used as "index numbers" for your 1st and 2nd arrays.  First, add numbers (in ascending order) to the "3rd" array fields.  When sorting by the "first" column, merely change the location of the 3rd arrays field values (don't change the positions of the fields in the 1st and 2nd array!!).  After the sort, the location of the 3rd array field values represent to sort, which can be used as indexs to the 1st and 2nd field contents.

Again, you may have to write your own sorter for this one (sort tag), which augments the function of sorting indexs.

Good Luck.

LB
0
 
dapperryCommented:
Can you give an example of what you are trying to do, what the sample array would look like, and what the desired result would be?  Thanks.

:) dapperry
0
 
cheekycjCommented:
yeah... need an example/illustration of this.

CJ
0
All Courses

From novice to tech pro — start learning today.