Gossamer Forum
Home : Products : DBMan : Customization :

A little question...

Quote Reply
A little question...
Hi! I would like to know is it is possible to customised sorting fields according to a criteria. Let me explain. I have a field called Ranks and the values are military ranks. Is it possible to do a sort from the highest to the lowest ranks and vice versa? Right now the sort options only sorts either by numbers/alphabetical order. However, for ranks say Lieutenant Commander and Lieutennant, the sort oder is wrong. Lieutenant Commander is obviously higher in rank than Lieutenant.

Anyone has any ideas?

Quote Reply
Re: A little question... In reply to

Someone you might want to ask about this is "TheFew".
His email is available under his profile.

He created an extensive site for Marines, and I think I remember him doing something like that?

Also if your sites are similiar he would most likely share some great ideas with you.

Unoffical DBMan FAQ
Quote Reply
Re: A little question... In reply to
Just thought of this while reading your post.
I know little of military ranks but I asume there may not be a great many.
What you could do is give each rank it's own value and sort on that.
Try this -
Ad an extra field to your db called somthing like,
sort_on => [15, 'numer', 2, 2, 0, '', ''], #change field number to match your database,
then at the top of sub add_record or your db.cgi add a bunch of if statements,
if ($in{'rank'} eq Lieutenant Commander) {
$in{'sort_on'} = 1; }
if ($in{'rank'} eq Lieutenant) {
$in{'sort_on'} = 2; }
and so on.
Then you can sort by the sort_on field.
Should work.


Quote Reply
Re: A little question... In reply to
Thanks to both Bob and LoisC for theor reply. I'll check it out.