Bayo,

 

You can always create a custom query in your custom gateway. Reactor  doesn’t support top in his OO queries.

 

 

João Fernandes
Dep. Informática - Área de Desenvolvimento
Cofina media

Avenida João Crisóstomo, Nº 72 . 1069-043 Lisboa PORTUGAL
Tel (+351) 213 185 200 . Fax (+351) 213 540 370
[EMAIL PROTECTED]

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of bayo ojo
Sent: quarta-feira, 28 de Junho de 2006 15:43
To: [email protected]
Subject: RE: [Reactor for CF] Newbie Question ... Get 5 Most Recent?

 

Is there no way to just restrict the selection from the database to just a recordset of 5, cos it looks like this will actually select all and then one picks the 5 top rows?

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug Sims
Sent: Wednesday, June 28, 2006 3:58 AM
To: [email protected]
Subject: Re: [Reactor for CF] Newbie Question ... Get 5 Most Recent?

 

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


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