<!--- This example shows ListContains --->
<HTML>
<HEAD>
<TITLE>ListContains Example</TITLE>
</HEAD>

<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">
<H3>ListContains Example</H3>

<CFIF IsDefined("form.letter")>
	<!--- First, query to get some values for our list --->
	<CFQUERY NAME="GetParkInfo" DATASOURCE="cfsnippets">
	SELECT 	PARKNAME,CITY,STATE
	FROM	Parks
	WHERE	PARKNAME LIKE '#form.letter#%'
	</CFQUERY>
	<CFSET tempList = ValueList(GetParkInfo.City)>
	<CFIF ListContains(tempList, form.yourCity) is not 0 OR form.yourCity is "">
	<P><CFIF form.yourCity is "">The list of parks for the letter <CFOUTPUT>#form.Letter#</CFOUTPUT>
		<CFELSE>There are parks in your city!
	   </CFIF>
     <CFQUERY NAME="GetLocalParks" DATASOURCE="cfsnippets">
		SELECT PARKNAME, CITY, STATE
		FROM Parks
		WHERE <CFIF form.yourCity is "">PARKNAME LIKE '#form.letter#%' <CFELSE>PARKNAME LIKE '#form.letter#%' AND city LIKE '#form.yourCity#%'</CFIF>
		</CFQUERY>
		<UL>
		<CFOUTPUT query="GetLocalParks">
			<LI><B>#Parkname#, <I>#City#, #State#</I></B>
		</CFOUTPUT>
		</UL>
	<CFELSE>
	<P>Sorry, there were no parks found for your city.
	Try searching under a different letter.
	</CFIF>
</CFIF>

<P>Select a letter of the alphabet, and see
if a park for your city is in the list of
parks in the database for that letter.  This is a case-
sensitive search.
<P><I>If you are unsure if your city is represented,
leave the city field blank and see the list of parks for
each letter; or, enter only the first letter or two of
that city.</I>

<FORM ACTION="listcontains.cfm" METHOD="POST">
Letter Park Name begins with:
<SELECT name="Letter">
	<OPTION value="A" SELECTED>A
	<CFSET temp = "B">
	<CFLOOP FROM="1" TO="25" INDEX="Counter">
	<OPTION value="<CFOUTPUT>#temp#">#Temp#</CFOUTPUT>
	<CFSET temp = CHR(Evaluate(Asc(temp) + 1))>
	</CFLOOP>
</SELECT>
<P>Name of your city: <INPUT TYPE="Text" NAME="YourCity" VALUE="QUINCY">
<BR>(<I>hint: try "A", "QUINCY"</I>)
<INPUT TYPE="Submit" NAME="Find the Park">
</FORM>

</BODY>
</HTML>       
