Gossamer Forum
Home : Products : DBMan : Installation :

Range search "=>" or "=<" in Search form

Quote Reply
Range search "=>" or "=<" in Search form
Hi JP.

How can a person which accesses the search form can look up in any number field and just put "=>" or "=<" it doesn't work. it only works if you put "greater or lower than" but not "equal or greater than".

Regards

BrianL
Quote Reply
Re: Range search "=>" or "=<" in Search form In reply to
You would have to make a change to sub query in db.cgi.

You can try this, although I'm not sure it will do what you want.

In sub query, after

Code:
if ($in{$column} =~ /^\>(.+)$/) { ($db_sort{$column} eq 'date') and (&date_to_unix($1) or return "Invalid date format: '$1'");
push (@search_gt_fields, $i); $in{"$column-gt"} = $1; $i++; next; }

add

Code:
if ($in{$column} =~ /^\=\>(.+)$/) {
push (@search_gt_fields, $i); $in{"$column-gt"} = --$1; $i++; next; }

and after

Code:
if ($in{$column} =~ /^\<(.+)$/) { ($db_sort{$column} eq 'date') and (&date_to_unix($1) or return "Invalid date format: '$1'");
push (@search_lt_fields, $i); $in{"$column-lt"} = $1; $i++; next; }

add

Code:
if ($in{$column} =~ /^\=\<(.+)$/) {
push (@search_lt_fields, $i); $in{"$column-lt"} = ++$1; $i++; next; }

It might work.

------------------
JPD