Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Order of Multiple Field VAlues

Quote Reply
Order of Multiple Field VAlues
Hi,

I use some fields that have multiple values and that is working great with Links SQL 2.0.5. My problem is that I have a field called Start_Months and use checkboxes and the twelve values for this field are the months of the year (January, February, March, etc.).

My problem is that the field values are always displayed in alphabetical order (April, August, December, February, etc.). Does anyone know if there is any way to get them to display in the order of the actual months (January, February, March....)?

Any help or ideas would be much appreciated!

-jw
Quote Reply
Re: [jwalter] Order of Multiple Field VAlues In reply to
Hi,

You could edit admin/GT/SQL/Display/HTML.pm, and in sub checkbox around line 367 change:

my $sort_f = exists $opts->{sort} ? $opts->{sort} : sub { lc $hash{$a} cmp lc $hash{$b} };

to:

my $sort_f = exists $opts->{sort} ? $opts->{sort} : '';

That should remove the alphabetical sorting.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Order of Multiple Field VAlues In reply to
Thanks very much Alex Smile I just got back today and saw your reply. I tried this, but now it seems to display the months in random order. (neither alphabetical, or the order that they appear on the multiple values list).

Actually, I mainly want it to be formatted in the January, February, March... order on the templates (such as link.html or detailed.html).

In another thread, you had showed how to add a global that would add a comma between multiple values for a field. In this case the field is called 'Start' and it has the months of the year:

Start_Format =>

sub { my $tags = shift; my $output = join ", ", split (/\n/, $tags->{Start}); return $output;}

This worked great, but does anyone know if there is anything that can be added to this global so that the months are added in January, February, March, April... order, (the order that is specified on the value list in the link properties)?

-jwalter


Quote Reply
Order of Multiple Field Values In reply to
HI Alex,

Has any progress been made on this?

I desperately need to have the checkbox/radio values presented in the order they are entered in the "Form Names" (Stored in Database). I can get them in numerical order, alphabetical or random order, but not in the order in which I type them.

Is there anything that can be done?

peace.

Kyle
Quote Reply
Re: [jwalter] Order of Multiple Field VAlues In reply to
The easiest solution is, to change the month names in Config.
You should rename them as:
"01 January",
"02 February",
etc..

This way, you still get sorted alphabetically (using the numbers), and you do not have to change the core code itself. Well, the numbers will be displayed in the forms, but I think this is not so disturbing, that does not worth the change.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Sep 14, 2002, 3:16 AM