[Search Criteria]Found Items[/Search]
Searches a database and displays the found records.
SQL/ODBC Note: To search through an ODBC-compliant database, use the [SQL] context.

To display search results from a database, place a [Search] context into a WebDNA template. You may specify any database and any search criteria. You may put as many [Search] contexts into a template as you want, and you may 'nest' them inside of each other to create relational searches between multiple databases. Alternately you may use the Search command from a form, and specify a template containing a [FoundItems] context.

Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):

[Search db=xx.db&eqNAMEdata=Grant]
Found [NumFound] items<br>
[Avg Price]<br> <!-- Calculate the average of the price field of all found records -->
[Sum QtyOnHand]<br> <!-- Calculate the total of the QtyOnHand field of all found records -->
<img src="[Picture].gif"><br>
[Name], [Address], [City]<br>

Whenever WebDNA encounters a [Search] context, it immediately opens the database and searches through it based on the search criteria you put into the search parameters. You nearly always place a [FoundItems]...[/FoundItems] context inside the [Search] context so you can display the information from the matching records.

Notice you can substitute any [xxx] tags in the search parameters, as in [Search db=[userDB]&eqNAMEdata=[username]].
Parameter Description
Name of the database you wish to search
New for WebDNA 5.x
In place of a db file, you can specify a named reference to a WebDNA table object.
A number indicating how many records should be displayed at once before showing a list of "Show Items xx-yy" hyperlinks.

The following tags are available inside a [Search] context:
Tag Description
A number indicating how many records matched the search request.
New in 4.0[Sum field=fieldName]
Calculates the numerical sum of all the found records, using the fieldName column.
New in 4.0[Avg field=fieldName]
Calculates the numerical average of all the found records, using the fieldName column.
New in 4.0[Min field=fieldName]
Calculates the numerical minimum of all the found records, using the fieldName column.
New in 4.0[Max field=fieldName]
Calculates the numerical maximum of all the found records, using the fieldName column.
Normally you place a [FoundItems] loop inside a [Search], so you can display all the matching records. You can put any database field names inside the [FoundItems] loop to display them in the HTML.
 [ReplaceFoundItems]...[/ReplaceFoundItems] Loops though all the found items and replaces text in each record with the specified new text.
Creates a list of links that let visitors see 'chunks' of search results.