[founditems], the companion context to [search], loops through the records retrieved by the search, and provides the means to display data from each record.
numero = 93[search db=xx.db&eqCITYdata=Chicago][founditems][index]. <b>[Name]</b>, [Address], [City]<hr>[/founditems][/search]This will display a numbered list of people with a horizontal rule separating each.When you are inside a search, and inside the [founditems] tags, you can retrieve all fields from the current record. These values can be easily intermixed with your html, as in the sample above. In addition, [index] is a counter that has many practical uses beyond the simple numbering seen here.
[fieldname] | Enclose any fieldname in square brackets to display the value |
[index] | A number indicating this record's placement in the list. Note that this number is not taken from the database, but is purely a counter as the records are retrieved. When records are split into chunks with the [shownext] context, subsequent pages will start with the index true to the total search, not just the group found on that page. |
[break] | From version 8.1, if the [founditems] context sees the [break] tag while executing a loop, it will stop looping, once it finishes the current loop. Thus the [break] tag should only appear in a [showif] statement that is evaluated at the end (bottom) of the loop. |
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. |
Tag | Description |
---|---|
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'. |
[founditems][dateacquired][field seek=named:dateAcquired&get=value&raw=T][/founditems]This would result in something like...04/23/20102010-04-23You 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. |
[SQLresult result_ref=rs1]List records in reverse order:<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]The [founditems] context goes between the search tags. If the search specified a maximum number of matches, then only that many will be displayed in the [founditems] loop.
[search db=xx.db&eqCITYdata=Chicago]
[founditems]
[index]. <b>[Name]</b>, [Address], [City]<hr>
[/founditems]
[/search]
[fieldname] | Enclose any fieldname in square brackets to display the value |
[index] | A number indicating this record's placement in the list. Note that this number is not taken from the database, but is purely a counter as the records are retrieved. When records are split into chunks with the [shownext] context, subsequent pages will start with the index true to the total search, not just the group found on that page. |
[break] | From version 8.1, if the [founditems] context sees the [break] tag while executing a loop, it will stop looping, once it finishes the current loop. Thus the [break] tag should only appear in a [showif] statement that is evaluated at the end (bottom) of the loop. |
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. |
Tag | Description |
---|---|
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'. |
[founditems]
[dateacquired]
[field seek=named:dateAcquired&get=value&raw=T]
[/founditems]
[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.
|
[SQLresult result_ref=rs1]Terry Wilson
List records in reverse order:
<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]
DOWNLOAD WEBDNA NOW!
BioType is a behavioral biometrics WebDNA function based on ADGS research and development (from version 8...
Tips and TricksA list of user-submitted tips ...
WebDNA ModulesA list of the currently available modules...
WebDNA LibrariesA list of available libraries for WebDNA...
Download WebDNA ApplicationsWebDNA applications...
Technical Change HistoryThis Technical Change History provides a reverse chronological list of WebDNA changes...
Executes and persits the results of an SQL statement...
ODBCUNIX: Setting up WebDNA - ODBC - Database Server...
[sendmail]There is hardly a website that doesn't at some point need to send an email...
[encrypt][encrypt] and [decrypt] allow you to store sensitive data in your databases without risk of exposing it to prying eyes...
[redirect]...
[listmimeheaders]Lists all the MIME header names and values sent from the remote browser...