Use the [Search] context with [founditems] to easily retrieve records from your databases.
Your search found [numfound] items
[Name], [Address], [City]
previous/current/next page links go here
|[NumFound]||A number indicating how many records matched the search request.|
|[sum field=fieldName]||Calculates the numerical sum of all the found records, using the fieldName column.|
|[avg field=fieldName]||Calculates the numerical average of all the found records, using the fieldName column.|
|[min field=fieldName]||Calculates the numerical minimum of all the found records, using the fieldName column.|
|[max field=fieldName]||Calculates the numerical maximum of all the found records, using the fieldName column.|
|[founditems]...[/founditems]||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.|
|[shownext]...[/shownext]||Creates a list of links that let visitors see 'chunks' of search results.|
typically "and" will find fewer matches in a database, because it is more restrictive -- the chances of finding a house that matches all 3 criteria simultaneously is far lower than finding a house that matches any one of the criterion individually.
|FirstName is Grant and LastName is Hulbert||eqFirstNamedatarq=Grant&eqLastNamedatarq=Hulbert|
|Bedrooms > 5 and fireplace is True and Bathrooms is 2||grBedsdatarq=5&eqFireplacedatarq=T&eqBathsdatarq=2|
You can make all fields required in one simple step by putting "AllReqd=T" into the form.
you can also embed a [search] context in a template. Any browser accessing that HTML page (no special commands required - just link to the page) will see the 'live' search results. It might look like the following
Here's an embedded search:<br>
[FirstName], [Address], [City], [State], [Zip]<br>
|ne||not equal to|
|ge||greater than or equal to|
|le||less than or equal to|
|rn||range. Specify two values separated by spaces (or any other delimiter specified by wbrk; i.e., ...&wbrk=,&...). The values may be dates, numbers, or text. If date, time or number, you must specify what type of data by using fieldnametype=xxx (where xxx is num, date or time).|
Example: rnBirthdaydata=02/28/2008 08/31/2008&Birthdaytype=date
Note: When specifying a range, the smaller value must precede the larger value, i.e. rnZipCodedata=92069 93090, not rnZipCodedata=93090 92069.
|mr||minimum range value: if no maximum then ge is used instead|
|mx||maximum range value: if no minimum than le is used instead|
|cl||close to (numeric only). clZipCodedata=92069&clZipCodedata=10 finds all records whose ZipCode field is within 10 of 92069 (92059 - 92079)|
|ew||ends with (from 8.6)|
|ws||Interpret the words as a single string to be matched (including spaces etc.) This lets you find entire phrases, like "Joe enjoys butter" only if those 3 words are next to each other in that order, including spaces (unlike wa and wo, below)|
|wa||Separate the words and "and" them together (all must match). Searching for 3 words using wa will match only if all 3 are in the field, but not necessarily next to each other.|
|wo||Separate the words and "or" them together (at least one must match - default option for text). Search for 3 words using wo will match if any one of them matches.|
|wn||word not equal - none of the words match text in the specified field|
|Word breaks: Use Wbrk to define what constitutes a word. By default, a space is a word delimiter, but you can define your own delimiter(s) using wbrk; example: fieldnameWbrk=,-;.|
|Word position in field: Use Word to define where you want the word to be found. Example: fieldnameWord=ww|
|ss||SubString match. Looks for word anywhere, even inside larger words. Finds "I like typographic conventions" and "This is a graphic" and "Graphical user interfaces are cool."|
|ww||Whole Word match. Looks for whole word; ignores if found inside a larger word. Finds "This is a graphic"|
|sw||Start of Word. Looks for word at the beginning of words. Finds "This is a graphic" and "Graphical user interfaces are cool."|
|Case sensitivity: Conducts case sensitive searches. |
AllCase=t (apply to all fields)
|Finding Empty Fields and Find All|
[blank] is a special WebDNA tag available in searches to explicitly find empty records. In practice, it is more often used to find records which are NOT empty, which is one way to "find all". Here are two popular ways to Find All:
The second example, of course, assumes you don't have a field value of FindAll.
Alternately, you can use the form FieldNameBLNK=T, which makes it possible to use radio buttons or checkboxes to let the visitor decide how they want to search for blank fields. If you want to apply this to all the fields in your search at once, then set allBLNK=T.
When assigning groups, you must name them sequentially, without skipping numbers.
If you plan to work on several groups, the groupfields definitions must be placed at the beginning of the search string. For instance
has to be written in this order:
You cannot skip a number in the sorting hierarchy.
|as||ascending (the default, if nothing specified)|
|Maintain randomness: Sometimes you need a series of random sorts to always present the exact same 'random' order. You can force the randomizer to return items in the same order if you add another parameter "RandSeed=879" (or any other integer number). This is most helpful when you use [shownext] and you need each successive set of links to predictably return the results in the same order.|
|No sorting at all: Results are displayed in exactly the same order they appear in the database file.|
[city], population [citypop] <br>
has [numfound] cities.<p>
You can define your own custom list of word break characters with
. By adding Descriptionwbrk=.,- to your search causes user-entered text surrounded by those characters in the HTML form field Description to be considered as individual words.
|ss||Descriptionword=ss looks for "graphic" and finds it anywhere inside phrases such as: "I like typographic conventions" and "This is a graphic" and "Graphical user interfaces are cool."|
|ww||Descriptionword=ww looks for "graphic" and will not find it inside phrases such as: "I like typographic conventions". It will be found inside "This is a graphic."|
|sw||Descriptionword=sw looks for "graphic" at the beginning of words, like "This is a graphic" and "Graphical user interfaces are good", but will not find it inside "I like typographic conventions."|
Basically, "wbrk" tells WebDNA how to break up the values you pass in your search context, while "fbrk" tells WebDNA how to break up the values stored in the database.Terry Wilson
DOWNLOAD WEBDNA NOW!
This Technical Change History provides a reverse chronological list of WebDNA changes...F.A.Q
A compilation of some user's questions...Download WebDNA Applications
WebDNA applications...WebDNA Libraries
A list of available libraries for WebDNA...WebDNA Modules
A list of the currently available modules...Tips and Tricks
A list of user-submitted tips ...
Checks legitimacy of credit card...[hideif]
[HideIf Comparison]Hide This HTML[/HideIf]...[!]
Executes the WebDNA inside the only [case] context which matches the given value...