Teddy Payne just provided the answer, which is the optional 4th argument which allows you to anchor the search clause.

/cody

Doug Sims wrote:
Thanks,
but this doesn't seem to work for me.
When I use IsLike() I get any match that contains the string, and it makes no difference if I use the '%'

For example:
<cfset Query.getWhere().isLike("Person", "firstname", "co%")>

will return 'cody' as well as 'marcos'. I need only cody returned, as this is for a rolodex type contact list s(o everyone needs to only appear once, and under the right letter.

Doug S




On 6/9/06, *Cody Caughlan* <[EMAIL PROTECTED] <mailto:[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] <mailto:[email protected]>
     > Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
     > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    -- --
     > -- -- --



    -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    -- -- -- --
    Reactor for ColdFusion Mailing List
    [email protected] <mailto:[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/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Reply via email to