Gossamer Forum
Home : Products : DBMan : Customization :

Combining similiar results

Quote Reply
Combining similiar results
Not sure if this is the best way to do this, but it seems to be the simplist up to this point. Here is the situation.

I have created a site for a commercial realty leasing firm. The database is used to list the different properties they own and include the basics like the city, the price, the size, etc...

The part that starts to get complicated is that each property has multiple suites of varying sizes. Some properties have only one size. What I ended up doing is entering each property at once, then an additional time for each suite. The size field contains individual suite size.

Of course, what happens when you specify a tight range in the suite field is you get only a single entry for any particular property. But if you enter a broad range then it lists the multiple instances in the results.

What I want to do is have the script analyze the results looking at a particular field (like the property's name) and if there are multiple instances of that identical field it will simply SKIP printing the duplicate results. Even better, if the script could somehow print something like "this property has 3 suites matching your search" by counting the duplicate results it would be better!

I know there is a way to do this. I read the step-by-step building of the baseball stats database in this forum and decided that it was just too complicated for what I needed. I'm hoping that a simple few lines of code will take care of this, but I am no CGI master and when it comes to writing code from scratch I just don't have the skills.

Thanks,
Darren

Quote Reply
Re: Combining similiar results In reply to
I would recommend using the Relational Mod.

Regards,

Eliot Lee
Quote Reply
Re: Combining similiar results In reply to
OK, here is what I think would solve this, with as much simplicity as possible. I just don't know how to write the code.

Someone performs a search. The script writes the first record, looks at a field I specify, lets say the "Title" field, then saves the data in that field as a variable. Then the script moves on to repeat the process and print the next record that matches the search...

...at which point the script analyzes the "Title" field in the new record and makes a determination as to whether it matches the last record (the saved variable) or if it is new. If it is the same as the last record then it simply skips that and repeats the process on the next record. If there is a difference then it prints the record and saves the new "Title" into the variable.

Does ANYONE know how to do this????

Quote Reply
Re: Combining similiar results In reply to
You could simply add the following link in the sub html_view_success routine:

Code:

<a href="$db_script_url?db=$db_setup&Title=$in{'Title'}&ww=on&view_records=1">Similar Records</a>


Good luck!

Regards,

Eliot Lee
Quote Reply
Re: Combining similiar results In reply to
I think I have seen a solution for what you are trying to accomplish, but briefly looking through the FAQ noted below I think this thread may be of use.

Look under the section "Search" for a thread called "Double search output".

I think this can be modified to accomplish what you want. If not, please search through all the threads in that section, as I know there has been more than one solution to this type of request. You might also want to check under the section for "Viewing".

Hope this helps or provides some ideas

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Combining similiar results In reply to
The solution I provided DOES WORK! It works fine in my site, no real need to search the FAQ.

Regards,

Eliot Lee
Quote Reply
Re: Combining similiar results In reply to
Well, in retrospect if I would have known about relational databases when I started I would have probably attempted it, but I've hacked my way through the code and changed a bunch of stuff around. I have a feeling that if I tried to add a relation mod now it would crash the entire thing.

ANTHRORULES:
I see where you are going with that, but what your link accomplishes is listing all other records with the same "Title". I want to do the opposite, I want the search to list only ONE record with each "Title", and it can't be a link that the user has to click on, it must be performed within the script (or somehow configured in a hidden field in the search page).

Here is my non-cgi example:
-SEARCH PERFORMED
-PROCESSING RESULTS
-1st result analyzed, "Title: NW Retail"
-1st result printed, "Title: NW Retail"
-2nd result analyzed, "Title: NW Retail", printing skipped
-3rd result analyzed, "Title: SW Office",
-3rd result printed, "Title: SW Office"
-etc...

So if two or more records IN A ROW (they will always be in a row becuase of how they are entered into the system) have the same "Title" then I want every one AFTER the first one to be skipped.

Does this make sense? Is it possible?





www.meltedmonitor.com | www.vtecengines.com | www.nwstreetracing.com | www.unnatural.org
Quote Reply
Re: Combining similiar results In reply to
LoisC:

I am also searching those files, I'm hoping to find the answer there. Cross your fingers. :) Thanks.


www.meltedmonitor.com | www.vtecengines.com | www.nwstreetracing.com | www.unnatural.org
Quote Reply
Re: Combining similiar results In reply to
I can't seem to find anything that matches on that web page. I'll look some more, but I don't know if this has been attempted before.

www.meltedmonitor.com | www.vtecengines.com | www.nwstreetracing.com | www.unnatural.org
Quote Reply
Re: Combining similiar results In reply to
I still can't see, to figure this out. I know there are some Perl gurus in here! Even if you can simply tell me that it isn't possible it would be helpful, then I could try to find another solution... Thanks much!

www.meltedmonitor.com | www.vtecengines.com | www.nwstreetracing.com | www.unnatural.org
Quote Reply
Re: Combining similiar results In reply to
Please scan through the various sections of the FAQ noted below as this has been done and is referenced there.

I just ran across the thread when looking for something myself late last nite, but forget where I wrote down the url. I believe it was under "Viewing".

It really doens't take that long to view the topics and check the various thread references. I believe there may even be a few methods of doing this. Also check under "Files / Records".

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/