Forum Discussion
mcbootus
15 years agoContributor
Dear Henrik,
Thanks for your code - everything is working fine on the sort but now I have a situation where more than one array column needs to be sorted, first the date then another value. I dont understand the top section pasted below - it seems that this code only works with sorting one property. But I cannot re-use it again to sort something else. What confuses me is this code doesn't point to a specific array and rather its generic - I have a "masterArray" to arrange by date and then I have another column in another array called "dbArray" where I need to arrange by "ID number".
How can I make this code sort specific arrays by name rather than generically ?
Thanks again for your help.
Armen
Thanks for your code - everything is working fine on the sort but now I have a situation where more than one array column needs to be sorted, first the date then another value. I dont understand the top section pasted below - it seems that this code only works with sorting one property. But I cannot re-use it again to sort something else. What confuses me is this code doesn't point to a specific array and rather its generic - I have a "masterArray" to arrange by date and then I have another column in another array called "dbArray" where I need to arrange by "ID number".
// Returns and removes the list with the lowest/earliest Date from myArray
def extractFirstOrdered( myArray )
{
firstOrdered = null
for( list in myArray )
{
if( firstOrdered == null || list[2] < firstOrdered[2] )
firstOrdered = list
}
myArray.remove( firstOrdered )
return firstOrdered
}
How can I make this code sort specific arrays by name rather than generically ?
Thanks again for your help.
Armen