Results Template
Example of a Results page
Linking to another page and passing an id
##DataShare.SCORES_DOORS.RecordSetStart## ##OrderBy.TRADNAME.ASCENDING## <div style="width:400px;"> <h2><a href="##HTMLFieldLink.UKEY.FHRDetailScreen.UKEY##">##Field.TRADNAME##</a></h2> <p>##Field.LOOKUP_FIELD##</p> </div> ##DataShare.SCORES_DOORS.RecordSetEnd##
Result:
For every match found the results will be returned in ascending order by TRADNAME. Each row will display the TRADNAME field, from the SCORES_DOORS table, containing a hyperlink using the UKEY field to the FHRDetailScreen template. The LOOKUP_FIELD will also be displayed. See the above Example of a Results page to see how the code is rendered.
A parameter will be added to the querystring of the following page e.g.
&Filter=^UKEY^='##Field.UKEY##'
where ##Field.UKEY## will be replaced by the value of the UKEY field in the recordset.
Â
The ##HTMLFieldLink## tag should be placed between
##DataShare.DSName.RECORDSETSTART## and ##DataShare.DSName.RECORDSETEND## tags.
Overriding the maximum number of results returned & number of results per page
In the Search Template the default maximum number of records returned is 100 with 10 results per page. If you wish to change this you may do so by specifying the following parameters between the RecordSetStart and RecordSetEnd tags.
##DataShare.Astun_DCAPPL.RecordSetStart## ##LimitRecs.150## ##PageRecs.15## ##DataShare.Astun_DCAPPL.RecordSetEnd##
In the above example up to 150 results will be returned with 15 on each page.
Ordering data in recordsets
##DataShare.Astun_DCAPPL.RecordSetStart## ##OrderBy.DATEAPRECV.DESCENDING## ##Field.ADDRESS## ##DataShare.Astun_DCAPPL.RecordSetEnd##
In the above example data will be ordered by DATEAPRECV in descending order. If required more columns can be specified e.g.
##OrderBy.DATEAPRECV,ADDRESS.DESCENDING##
Paging
There are two types of paging tags both of which have been used in the Example of a Results page above.
"Google" Style
This example will produce 'Google' style page navigation e.g. 1 2 3 4
##PageNavRecordStart## ##PageNo## ##PageNavRecordEnd##
This results in the current page being called again with a &pageno=x appended to the querystring.
"Button" Style
This type of paging produces 'button' style navigation e.g. First Previous Next Last
<td>##FirstPageButtonStart##First##FirstPageButtonEnd##</td> <td>##PrevPageButtonStart##Previous##PrevPageButtonEnd##</td> <td>##NextPageButtonStart##Next##NextPageButtonEnd##</td> <td>##LastPageButtonStart##Last##LastPageButtonEnd##</td>
Â
Any values can be placed between the ##ButtonStart## and ##ButtonEnd## tags.
Filtering
Records returned can be restricted using the following syntax:
##DataShare.EmployeeCoverage.RecordSetStart## ##Filter.^Employees_EmployeeID^=5## ##Filter.^EmployeeTerritories_TerritoryID^='02903'## <tr> <td>##Field.Employees_FirstName##</td> <td>##Field.Employees_LastName##</td> <td>##Field.Territories_TerritoryDescription##</td> <td>##Field.EmployeeTerritories_TerritoryID##</td> </tr> ##DataShare.EmployeeCoverage.RecordSetEnd##
In this case we are restricting to EmployeeID = 5 and Territory = 02903.
Displaying Errors
It is possible to apply custom formatting to error messages (No rows found or other types). This can be done by using code similar to the following:
##ErrorMessageStart## <b> ##ErrorMessage## </b> ##ErrorMessageEnd##
Any type of markup can be put between the Start and End tags. ##ErrorMessage## will be replaced with any error message that is generated.
No Rows Message
Show a message if no rows are found by adding the following tags directly under the ##DataShare.Data.RecordSetStart## tag:
##NoRowsMessageStart## Your message here! ##NoRowsMessageEnd##
If there are no tags like these defined, then no data or message will be displayed in the case of no data being found.