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):
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 |
---|---|
db
|
Name of the database you wish to search |
table |
New for WebDNA 5.x In place of a db file, you can specify a named reference to a WebDNA table object. |
max
|
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 |
---|---|
[NumFound]
|
A number indicating how many records matched the search request. |
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. |