WebSTAR 4 Manual & Technical Reference

Manual Contents | Chapter Contents | Previous Page | Next Page

Displaying Search Results

Search results (also known as hits ) are those records which match the search terms and operators. Once FileMaker does the search, you need a way to send the data from the matched records back to the browser and show them to the user. You do this by setting up a page in HTML which stores placeholders for the data from the database, and shows it when the search is complete.

When you first created a search form, one of the required tags was -Response where the page containing the results of a search was specified. In the example Search Example , this page is called "hitlist.html" .

Listing the Matched Record Data

There are two important Lasso tags for formatting the results of searches and showing the data in the results page.

The [Field] Tag

The [Field] tag is a substitution tag, a place holder where data from a particular field is inserted. The name of the field you wish to display must be specified.

 

	[Field: 'Category']

When Lasso processes a page with the tag above, the data in the Category field of the current record will be inserted in place of the tag. It's OK if your field names have spaces, as the WebSTAR Lasso Publisher Plug-In will replace the field name with the text from the field before sending it to the browser.

The [Field] tag cannot be used by itself to display images stored in FileMaker Pro container fields. For more information about displaying images from a container field, please refer to the [Image] tag in the LDML 3.5 Reference Database .

The [Records]...[/Records] Container

This hitlist.html page displays a list of records that match the terms searched on using the search form. Because some searches will result in one or two matching records, while others may have dozens, we need a way to specify what information we want to be displayed for each matching record and let Lasso handle displaying the actual data. The [Records] ... [/Records] container is used to achieve this. Take a look at this example:

 

<p>
 
Your search found the following matches:<br>
 
	[Records]
 
		[Field: 'Artist']: [Field: 'Title']<br>
 
	[/Records]
 
</p>

Lasso will repeat everything between [Records] and [/Records] once for each found record. As you can see, the page lists the artist name, a colon, and the title.

 

Navigating the Found Set

The next step is to set up links to navigate through hit lists too long to display on one page.

One of the parameters that a search form specifies is the maximum number of records to be displayed on a results page. This is done through the previously discussed -MaxRecords tag. But what happens if -MaxRecords is set to 10 and your search results in 25 matches? There must be a way to navigate past the first ten to see the next ten hits and the next five after that. LDML has a set of tags for this purpose.

[FoundCount]

Lasso substitutes the number of records in the found set for the [FoundCount] substitution tag. Regardless of how many records are currently displayed, the [FoundCount] value will always equal the found set of records in your database.

[Shown_First], [Shown_Last], [Shown_Count]

All three tags are substitution tags. [Shown_First] displays the record number of the first record displayed in a [Records] ... [/Records] list. [Shown_Last] displays the record number of the last record displayed in a [Records] ... [/Records] list. [Shown_Count] displays the total number of records displayed in a [Records] ... [/Records] list.

Using the four tags introduced above, you can display useful navigational information to the user such as in this example:

 

<p>
 
Displaying records [Shown_First] through [Shown_Last] out of [Found_Count] total found. ([Shown_Count] records displayed.)
 
</p>

[Shown_NextGroup]...[/ShownNextGroup], [Shown_PrevGroup]...[/ShownPrevGroup]

These two container tags will create a link to the next or previous set of matches. Any text or images you place between the opening and closing tags will be linked. When there are no previous matches to link to (such as on the first page of hits) Lasso will not display anything. Likewise, on the last page of hits, Lasso will not display anything in the [Shown_NextGroup] container. Here is some example code:

 

<p>
 
[Shown_PrevGroup]See Previous Page[/ShownPrevGroup] 
 
&nbsp;
 
[Shown_NextGroup]See Next Page[/ShownNextGroup]
 
</p>

Showing Details

Often, when presented with a list of matching records from a search, you'll want to see more details for an item on the list. The hitlist.html page (from the example on Search Example ) only displays the Artist and Title fields. For the user to see all the fields associated with that record in the layout, you can create a detail.html page with [Field] substitution tags for all the fields on the layout.

[Link_Detail]

Using the [Link_Detail] substitution tag, Lasso can automatically link each record in the hitlist to the detail.html page. You must include Layout and Response attributes in the Link_Detail tag.

 

<p>
 
Your search found the following matches:<br>
 
	[Records]
 
	<A HREF="[Link_Detail: Layout='Web', Response='detail.html']">
 
	[Field: 'Artist']</A>:
 
	[Field: 'Title']<br>				
 
	[/Records]
 
</p>

In the example above, the first name is a link to a page called detail.html where more information from each record can be viewed.

 

Creating a Detail Page

To show the details of a record, you simply create a regular HTML document inserting [Field] substitution tags wherever you want data from a field to show up. Before WebSTAR serves your page, the WebSTAR Lasso Plug-In will fill in the appropriate data from your database in place of the [Field] tags.

Keep in mind the proper syntax for field tags: [Field: 'field name here'] . The text "field name here" should be replaced with the name of your database field, surrounded by plain single quotes. Spaces and spelling count here, so be precise when entering your field names.


Manual Contents | Chapter Contents | Previous Page | Next Page