Gossamer Forum
Home : Products : DBMan : Discussions :

Search a subset of records

Quote Reply
Search a subset of records
Hi. I have a membership directory that will have about 300 records. I want to be able to display the 300 records with one link, and have another link that allows people to search only a subset of the database. The records that can be searched all have a series of letters in one field, say XYZ in field 3. Subsequent searches should also be only of the subset, not the entire database.

Can this be done? How?

Thanks very much.
klewando

Quote Reply
Re: Search a subset of records In reply to
You can have two entries in the search form, which would do basically what you're wanting.

How exactly do you envision this? I'm having a hard time picturing what you want to do.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Search a subset of records In reply to
Hi again.

My client is at http://www.svplanners.org/ If you click on Member Directory on the left side, you get a List All result - all the records are listed using the short/long mod.

If you click on Find a Financial Planner on the right side, you get the introduction page where you can click on the Search link. I need for this search link, and subsequent ones, to only search records with CFP in the designation field (only those people who are CFPs can be referred to the public).

HTH,
klewando

Quote Reply
Re: Search a subset of records In reply to
It would be really easy to do, except for the "Match Any" option. All you would have to do is to add a hidden field for the designation. But with "Match Any," this won't work.

You could hard-code it into sub query. Something like

Code:

# Normal searches.
$key_match = 0;
foreach $field (@search_fields) {
if (($values[field number for designation field] eq "CFP") || ($db_userid ne "default")) {
$_ = $values[$field]; # Reg function works on $_.
$in{'ma'} ?
($key_match = ($key_match or &{$regexp_func[$field]})) :
(&{$regexp_func[$field]} or next LINE);
}
}
This is purely a guess, but it might work. Smile

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Search a subset of records In reply to
Hi, JPDeni. Thanks for trying - unfortunately, it didn't work.

Suppose I didn't need the "Match Any" option. How would I add a hidden field to make this work?

Thanks,
klewando

Quote Reply
Re: Search a subset of records In reply to
Without the "Match Any" option, you just add a hidden field to the search form:

<input type="hidden" name="designation" value="CFP">



JPD
http://www.jpdeni.com/dbman/