Gossamer Forum
Home : Products : DBMan : Customization :

Multiple Fields Sort

Quote Reply
Multiple Fields Sort
Howdee,

I'm a recent fellow to Perl, even though I concentrate hard and pick it quickly, but I'm stuck on the Sorting function.
I'm looking for some help to sort based on multiple fields (3 max).
Could someone help me implementing a mutiple field sort even if it means implementing it as static code !!

Is it planned in a future release ??

Original Code source of version 2.04:
# Sort the array @hits in order if we are meant to sort.
if (exists $in{'sb'}) { # Sort hits on $in{'sb'} field.
my ($sort_order, $sort_func);
$in{'so'} ? ($sort_order = $in{'so'}) : ($sort_order = "ascend");
$sort_func = "$db_sort{$db_cols[$in{'sb'}]}_$sort_order";
foreach $hit (sort $sort_func (keys %sortby)) {
$first = ($hit * $#db_cols) + $hit; $last = ($hit * $#db_cols) + $#db_cols + $hit;
push (@sortedhits, @hits[$first .. $last]);
}
@hits = @sortedhits;
}

Thanks for your help.