[FoundItems Params]Database Fields[/FoundItems]
Lists all the matching records resulting from a search.

To display a list of all the matching records from a Search command or a [Search] context, put a [FoundItems] context into a WebDNA template. If the search specified a maximum number of matches, then only that many will be displayed in the [FoundItems] loop. To display the result of many searches on a single page, you may put the [FoundItems] context inside an embedded [Search] context. Also see [ShowNext].

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

[FoundItems]
Name: [name]<br>
Address: [address]<br>
Phone: [phone]<br>
<hr>
[/FoundItems]

You also use the [FoundItems] within a [SQL] context, to list the records resulting from a successfull ODBC/SQL query.

The [FoundItems] context is also used within a [SQLResult] context, to list the records resulting from a successfull Native SQL query.
When used within [SQLResult], the new 'Iterate' parameter can be specified to control the behavior of the [FoundItems] context.

In setting the 'iterate' parameter to 'manual', the [FoundItems] context behaves more like a collection. The WebDNA programmer can retrieve the found records in any manner they wish.

Parameter Description
Iterate

Only available within [SQLResult]

(Optional) - Manual/Auto - When set to MANUAL, the [FoundItems] context switches to 'manual' mode. The new [Seek] tag must then be used to 'move' the record set cursor. The cursor is always initialized to the first record position. When set to Auto - [FoundItems] reverts to default behavior, iterating the record set one record at a time, starting from the first item, and ending with the last item.

The following tags are available inside a [FoundItems] context:
Tag Description
[FieldName]
Name of any field in the database being searched.
[Index]
A number from 1 to the maximum number of matching records indicating this record's index placement in the list.
The following tags are only valid when [FoundItems] is used with a [SQLResult] context.
 [Field Params
The [field] tag is used within [FoundItems] to return information about a particular field of the current record.

Parameters:
seek (required) - The seek parameter uses a prefix-qualified naming semantic to select a specific field of the current record. You can use one of two possible prefixes for the value of the seek parameter... either named or ordinal; follow this with a ":" and the actual value which identifies the field (according to the prefix-qualifier).
For example:
seek=ordinal:1 - would select the first field
seek=named:employeeID - would select the field named "employeeID"

get (optional) - The get parameter accepts one of seven possible enumerated values:
NAME - Retrieves the field name.
ORDINAL - Retrives the field position.
DATATYPE - Retrievs the field data type.
WIDTH - Retrieves the max data length.
ALLOWNULL - T/F Resolves to 'T' if the field will accept a NULL value.
ISNULL - T/F Resolves to 'T' if the field value is NULL.
VALUE - Retrieves the field value.

raw (optional) - When retrieving field data where the field data type is: DATE, TIME, or DATETIME , WebDNA will 'interpret' the data based on the user defined WebDNA preferences for displaying Dates and Times.

However, if you wish to display the data in its 'raw' format, you can set the 'raw' parameter to 'T'.

For example:


[FoundItems]
[dateAcquired]<br>
[field seek=named:dateAcquired&get=value&raw=T]<br>
[/FoundItems]
This would result in something like...
04/23/2000
2000-04-23
You can see that the second line displays the data value in its 'native' format (MySQL stores dates in YYYYY-MM-DD).
 [Seek Params
When the 'iterate' parameter for [FoundItems] is set to 'manual'. The [Seek] tag is used to position the result set 'cursor' to a particular record.

Parameters:
To (required) - Can be one of four values:
First - set the cursor to the first record.
Last - set the cursor to the last record.
Prev - set the cursor back one record.
Next - set the cursor ahead one record.

Example:


[SQLResult result_ref=rs1]
List records in reverse order:<br>
<table>
<tr><th>ID</th><th>Date Acquired</th><th>Comments</th></tr>
[FoundItems iterate=manual]
[seek to=last]
[loop start=1&end=[numfound]]
<tr><td>[inventoryID]</td><td>[dateAcquired]</td><td>[comments]</td></tr>
[hideif [index]=[numfound]][seek to=prev][/hideif]
[/loop]
[/FoundItems]
</table>
[/SQLResult]