Search Groups Searching - Multiple Fields at Once GroupNField=fieldname1+fieldname2
Searches multiple fields at once.

Sometimes you want to search in many fields at once. For instance, you may want to look in the FirstName field and the LastName field without forcing the visitor to type the same thing into two separate form fields in the web page. Use group fields to combine several database fields into a single search.

If your database has a FirstName, LastName, and Address field that you want to look for the word "Lane" in, the URL might look like the following:

http://Results.tpl?command=search&group1field=FirstName+LastName+Address&wogroup1data=Lane

If the word "Lane" appears in any of the 3 fields FirstName, LastName or Address, then that record is considered a match.

Important: If your database fieldnames contain non-alphanumeric characters (such as the plus sign, space, comma, period, etc.) then WebDNA could have trouble distinguishing them in the list of multiple fields. In this case, you should use the alternate form for specifying groups (by adding an 's' to the end of 'GroupNField' and listing each field separately):
Group1Fields=first.name&Group1Fields=last.name
Also: You MUST number your groups sequentially, beginning with 1. If you fail to do this, some of your group fields may be ignored.

You can also use Group fields to search through different database fields depending on the radio button or popup a user chooses. The following HTML presents a form allowing the user to choose to search in different fields, or all fields at once.

Example 1: Allow the user to choose which field will be searched:

<form method="POST" action="Results.tpl">
<input type="hidden" name="command" value="Search">
<input type="hidden" name="db" value="catalog.txt">
<input type="radio" name="group1field" value="Description" checked>Description<br>
<input type="radio" name="group1field" value="SKU" checked>Product Number<br>
<input type="radio" name="group1field" value="Manufacturer" checked>Manufacturer<br>
<input type="radio" name="group1field" value="Description+SKU+Manufacturer" checked>All<br>
<input name="woGroup1data">
<input type="submit">
</form>

Example 2: Search two fields from a single text box:

<form method="POST" action="Results.tpl">
<input type="hidden" name="command" value="Search">
<input type="hidden" name="db" value="catalog.txt">
<input type="hidden" name="group1field" value="Description+SKU">
Type a Description or SKU:<input name="woGroup1data">
<input type="submit">
</form>

Example 3: Apply more than one comparison to a single field:

<form method="POST" action="Results.tpl">
<input type="hidden" name="command" value="Search">
<input type="hidden" name="db" value="catalog.txt">
<input type="hidden" name="group1field" value="Date">
<input type="hidden" name="group2field" value="Date">
Date:<input name="eqGroup1data">
<input type="hidden" name="grGroup2datarq" value="[date]">
<input type="submit">
</form>

User Contributed Notes
SearchGroups  

Govinda - govinda(DOT)webdnatalk(AT)gmail(DOT)com 
01/08/2011 at 16:59:01
It seems that grouped-fields searches only work properly when there are no *other* field comparisons also in the search params - other than the grouped field(s).
(I would have posted this note on the new site.. but do not see where to do that right now, when I look.)

Donovan - lists AT euca DOT us 
04/29/2012 at 14:24:59
Hi Govinda, 

I don't think you are correct. I am able to post a mix of grouped comparisons with non-grouped comparisons to produce the expected results just fine. Maybe post a snippet of code as to your issue.

Donovan

Copyright © 2008 WebDNA Software Corporation, Inc.