<CFIF IsDefined("Form.FilmID")>
   <!--- FilmID is specified --->
   <CFSET TheCriteria = "CF_CUSTOM1 <MATCHES> #Form.FilmID#">
<CFELSEIF (Form.Criteria NEQ "")>
   <!--- Film and keywords were specified --->
   <CFSET TheCriteria = "#Form.Criteria#">
<CFELSE>
   <!--- Neither keywords nor FilmID were specified --->
   <CFABORT SHOWERROR="Please enter your criteria">
</CFIF>

<CFSEARCH
   COLLECTION="Merchandise"
   NAME="GetResults"
   CRITERIA="#TheCriteria#"
>

<CFQUERY NAME="GetPrices" DATASOURCE="ows">
   SELECT MerchID, MerchDescription, MerchPrice
   FROM Merchandise
   WHERE MerchID IN (#ValueList(GetResults.Key)#)
</CFQUERY>

<HTML>

<HEAD>
<TITLE>Search Results</TITLE>
</HEAD>

<BODY>

<H2><CFOUTPUT>#GetPrices.RecordCount# merchandise item(s) found.</CFOUTPUT></H2>

<P ALIGN="RIGHT">
<CFOUTPUT>Actual Criteria Used:#HTMLEditFormat(Variables.TheCriteria)#
</CFOUTPUT>
</P>

<CFTABLE QUERY="GetPrices" COLHEADERS HTMLTABLE BORDER>
  <CFCOL HEADER="ID" TEXT="#MerchID#">
  <CFCOL HEADER="Description" TEXT="#MerchDescription#">
  <CFCOL HEADER="Price" TEXT="#MerchPrice#">
</CFTABLE>

</BODY>

</HTML> 
