Gossamer Forum
Home : Products : DBMan : Installation :

"" search problem

Quote Reply
"" search problem
Hi again JPD.

I'm having a problem with the ">" or "<" when doing searches greater or lower than in my number fields.

If I enter in field "Bolívares" to find for lower than 75.000.000 I am getting back numbers lower than 75.000.000 but can olso serach 75.000 or 75. and get back the same results.

Also I have 2 fields "Bolívares" and "USDólares" I would like the search to look only in records that have numbers in the Bolivares or US Dólares field (not empty) and only get records for the field I am looking for "Bolívares" or "USdólares".

For instance:
Looking for Bolívares <50.000.000, I want back only records that have something in the Bolívares field if the field is blank It means that it is in USDólares so I don't want it. And Vice-versa If I want <400.000 USDólares I want only records with something in the field and don't want to see the ones with Bolívares.

An easy way to look at it is tha the records that have a price in Bolívares WILL NEVER have a prive in USDólares and Vice-versa.

But the main problem is with the find that I am not getting the right return, I don't know if it is the points wich in spanish are used instead of comas in the thousands field or what the problem could be.

The html.pl and default.cfg are in: www.camposycampos.com/html_pl.txt and www.camposycampos.com/default_cfg.txt

Thanks again for your help.

By the way, the use of DBMan for this site has been registered.

BrianL
Quote Reply
Re: "" search problem In reply to
The first thing you need to do is delete all the commas and periods that indicate thousands.

Why don't you do that first and see if that makes a difference in your search results. Then we'll work on the other problem.

(Next time you have a question, could you please post it in the other forum? You already have the script installed and configured and I'm trying to keep the forums on generally on the same subject. Thanks! Smile )


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





Quote Reply
Re: "" search problem In reply to
Sorry JP.

I forgot what part of the forum I went in to.

Does this mean that anything after the first poit is ignored or is treated as a decimal?

Because it is a bit confusing when you need to enter a number like 300.000.000 and would look like 300000000.

By the way, is there a way you can pass this topic to the other forum or do you want me to place it in the Discussion forum so that you can delete it from this one?

Regards

BrianL
Quote Reply
Re: "" search problem In reply to
Yes. Anything after a "." is treated like a decimal.

We can work out adding the "." or "," to the way a record is displayed, but for searching purposes, you need to take those out.

Just continue on here. Since we've already started here, we might as well continue. My previous note was just for future reference. Smile



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





Quote Reply
Re: "" search problem In reply to
Thanks JP.

Yes. I wolud certainly like to show points for the thousands.
I could put a note on the search to tell the visitor not to put the points.

Also I would like to to see how I can change the script for when I search for "Bolívares" I would not get back the records with "USDólares" which have the "Bolívares" in blak and vice-versa.

Thanks a lot JP

BrianL
Quote Reply
Re: "" search problem In reply to
Before I answer your second question, let's finish with the first one.

Did it work when you took out the "."s and ","?


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





Quote Reply
Re: "" search problem In reply to
Hi JP.

Sorry for the delay. Yes, it worked fine.

I have another question y will post on the other forum.

Thanks

BrianL
Quote Reply
Re: "" search problem In reply to
To put back the . in the Bolívares field, add the following to sub html_record, just after

my (%rec) = @_;

Code:
1 while $rec{'Bolívares'} =~ s/(\d)(\d{3})\b/$1.$2/;

To put the "," back into the "USDólares" field, just below the above code, add

Code:
1 while $rec{'USDólares'} =~ s/(\d)(\d{3})\b/$1,$2/;

As for your other problem, I don't understand it.

If you search for, for example, 3000000 Bolívares, are you saying that you're getting back records with nothing in the Bolívares field?


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





Quote Reply
Re: "" search problem In reply to
Hi JP.

Thanks for the above!

The las question is easier than that:

When gests searches by the "Bolívares" field I would like NOT to get records that have anything in the "Dólares" Field and vice-versa. Because, first of all if a property is stated in one currency the other currency we leave blank. So when I look for Bolívares: "<1000000 I also get the ones with the dollars because the ones with the dollars have the Bolivares in Blank (which is "less than" because it is blank). This is the same the other way around. So I prefer if looking for one currency I should not need information in the other.

Get it this time? I had to read this twice to understand what I wrote. Sorry this is not my original language.

Thanks again

BrianL
Quote Reply
Re: "" search problem In reply to
Yes, now I understand. It's because you are doing a range search.

Here's something to try, although I can't promise anything:

In db.cgi, sub query, after

local ($sortby);

add

Code:
if ($in{'Bolívares'} =~ /^\<(.+)$/) {
$in{'Bolívares-lt'} = $1;
$in{'Bolívares-gt'} = 1;
$in{'Bolívares'} = '';
}
if ($in{'USDólares'} =~ /^\<(.+)$/) {
$in{'USDólares-lt'} = $1;
$in{'USDólares-gt'} = 1;
$in{'USDólares'} = '';
}

This should give you want you want. I hope. Smile


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





Quote Reply
Re: "" search problem In reply to
Thanks pal.
I'll let you know.

BrianL