Bre cognitive that you can define where to look for the wildcard:
<cfset Query.getWhere().isLike("Person", "firstname", "co%","left")>
Notice the fourth argument, which is optional. By default, the IsLike searches for "anywhere" and that acts like a substring when searching. If you want the pattern to start with the wildcard, then use "left." Analagous, if you want to search for the end of the field, use "right."
Cheers,
On 6/9/06, Cody Caughlan <[EMAIL PROTECTED]> wrote:
I accomplish that task by doing this:
<cfset Query = PersonGateway.createQuery()>
<cfset Query.getWhere().isLike("Person", "firstname", "co%")>
<cfset people = PersonGateway.getByQuery (Query)>
It looks like your only difference is you are using "isEqual()" where you should be using "isLike()".
/Cody
Doug Sims wrote:
> I am tring to pull back all records that start with a certain letter for
> example, the letter H.
>
> I first tried this:
> <CFSET memberQuery =membergateway.getbyfields(lastname="H%")>
> but get no records.
>
> I then tried a custom query, both with islike() and isequal()
>
> <CFSET query.getWhere().isEqual("member", "lastname",'H%')>
> <CFSET order = query.getorder().setasc("member","familyheadID")>
> <CFSET membergateway.createquery().setorder(order)>
> <CFSET memberQuery =membergateway.getByQuery(query)>
>
> I don't have access to see the debug, so I can't really tell what is
> going on with the generated query. any suggestions on how to do this?
>
> Thanks,
> Doug S.
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- -- --
> Reactor for ColdFusion Mailing List
> [email protected]
> Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
<cf_payne />
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

