In many cases you could use Just call getByFields(name=value, name2=value2) with name value pairs for the criteria to get filtered results, however for the last 5 by date you will need to create a custom query object and modify the order to sort desc by modifieddate and sort by that field.

here is how I would do it, others may have a better suggestion:

<CFSET userGateway = Application.Reactor.createGateway("user") />
<CFSET query =userGateway.createquery()>
<CFSET order = query.getorder().setdesc("user","modifieddate")>
<CFSET userGateway.createquery().setorder(order)>
<CFSET userrQuery =userGateway.getByQuery(query)>.
then you could loop through the userquery and use the first 5 rows
 
hope this help,
Doug S.


On 6/27/06, Jeff Chastain <[EMAIL PROTECTED]> wrote:
I have a table with contacts in it that has a lastModified field.  I am looking to get the 5 most recently modified contacts from this table.  The gateway object will return all records, but how do you pass criteria to it ... i.e. sort by lastModified and give me the top 5?  Is this something I need to custom write into the gateway object?
 
Sorry if this is too obvious.
 
Thanks
-- Jeff

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
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