Hi Lewis -
Sorry - I should have explained a little more. I am sure it will relate to
your search - all I am doing is gathering ways and/or methods of searching
and passing them as variables to a query. It could probably be applied to
searching and sorting your array. An added bonus: By giving your users
multiple ways of looking at the data - you can give yourself a workaround
for the Alpha Numeric listing issue... (Get me accounts that begin with "0"
- or get me accounts that begin with "A" ... etc.)
Here's more of what I am doing...
#URL.Sort# would Equal the Column Name - or What you want to Sort By
(FirstName, LastName, AccountNumber etc)
#URL.Order# would Equal ASC or DESC
#URL.Term# would equal a single Letter - like A or B or C (So, in my
example, getting all users whose last name begins with "c")
So, To start with - I would have a link like so:
<a href="#CURRENTPAGE#?Term=c">C</a>
To use it in a component - I pass it as so:
<cfparam name="URL.Sort" default="LastName">
<cfparam name="URL.Order" default="ASC">
<cfparam name="URL.Term" default="">
<cfinvoke
Component="GetUsers"
Method="getAllUsers"
TableSort="#URL.Sort#"
TableOrder="#URL.Order#"
Term="#URL.Term#"
Returnvariable="Users">
And the component would have my Query listed before (but with Arguments for
the URL Variables)
I could ALSO add the ability to add a FORM search to it - where I could
choose which Column I want to search and what I want to search for... (A
select dropdown would contain the "Columns" and a text input would contain
the data:
<cfparam name="URL.Sort" default="CustLastName">
<cfparam name="URL.Order" default="ASC">
<cfparam name="URL.Term" default="">
<cfparam name="FORM.FormType" default="">
<cfparam name="FORM.FormData" default="">
<cfinvoke
Component="Customers"
Method="ListCustomers"
Returnvariable="qryGetCustomers"
Sort="#URL.Sort#"
Order="#URL.Order#"
Term="#URL.Term#"
FormType="#FORM.FormType#"
FormData="#FORM.FormData#"
>
<form action="<cfoutput>#CurrentPage#</cfoutput>" method="post"
name="search">
<select name="FormType">
<option value="CustLastName" <cfif #FORM.FormType# EQ
"CustLastName">selected</cfif>>CustLastName</option>
<option value="CustFirstName" <cfif #FORM.FormType# EQ
"CustFirstName">selected</cfif>>CustFirstName</option>
<option value="EmailAddress" <cfif #FORM.FormType# EQ
"EmailAddress">selected</cfif>>EmailAddress</option>
</select>
<input name="FormData" type="text"
value="<cfoutput>#FORM.FormData#</cfoutput>" size="16"
ONFOCUS="clearDefault(this)"> <input name="submit" type="submit"
value="Search" alt="Search" align="absmiddle"><input type="hidden"
name="search" value="1">
</form>
I hope this helps...
- Nick
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4105
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15