I don't have reactor code right here but I think that Iterator object has a 
GetQueryObject() which is a reactor.query.query so you could

<cfset 
customer.getInvoiceIterator().getQueryObject().setAsc("invoice","myfield").setDesc("invoice","myotherfield")>
<cfset invoices = customer.getInvoiceIterator().getQuery()>

it should work,

João Fernandes

-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Beth Bowden
Sent: Mon 10-Jul-06 9:35 PM
To: [email protected]
Subject: Re: [Reactor for CF] Iterator Quesion
 
How would you set the order on this query?

Thanks,

Beth

On 7/10/06, Doug Hughes <[EMAIL PROTECTED]> wrote:
>
> FYI, it's not _getQuery() as shown here:
>
> <cfset invoices = customer.getInvoiceIterator()._getQuery()>
>
> It's getQuery() as shown here:
>
> <cfset invoices = customer.getInvoiceIterator().getQuery()>
>
> Doug
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Jared Rypka-Hauer
> Sent: Monday, July 10, 2006 2:02 PM
> To: [email protected]
> Subject: Re: [Reactor for CF] Iterator Quesion
>
> Dan,
>
> You should be able to shorten your code here this way:
> <cfset customer =
> application.cs.getBean("CustomerRecord").load(customerId=url.id)>
>
> load() should return the record... unless this has changed
> in the API. It hasn't *that I know of*. The way you have it
> written now you end up with 2 customer records...
> CustomerRecord and Customer. CustomerRecord is empty and
> Customer has data... the former is an unneeded object.
>
> As far as getting the ID while you're looping...
>
> <cfloop query="invoices">
>     <cfset ciID = invoices.customerInvoiceId>
> </cfloop>
>
> Also, this bit here:
>
> <cfset invoices =
> customer.getInvoiceIterator()._getQuery()>
>
> Should probably be:
>
> <cfset customerInvoices =
> customer.getCustomerInvoiceIterator()._getQuery()>
>
> IIRC, the results from that call should be a join between
> the Invoice table and the Customer table based on the
> customerId in the current instance of Customer... you
> should actually have 2 iterators as members in your
> Customer object, one for Invoices and one for
> CustomerInvoices, because of the hasMany linkages between
> the various object tags.
>
> I may be wrong, and I'm working entirely from memory
> here... but if I remember correctly that's how it SHOULD
> work.
>
> Someone please correct me if I'm wrong?
>
> Laterz,
> J
>
> On Mon, 10 Jul 2006 12:49:44 -0400
> "Dan Vega" <[EMAIL PROTECTED]> wrote:
> > Let's say for example I have 3 tables.
> > Product,Invoice,ProductInvoice and my
> > reactor.xml looks like this.
> >
> >         <object name="Customer">
> >             <hasMany name="Invoice">
> >                 <link name="CustomerInvoice"/>
> >             </hasMany>
> >         </object>
> >
> >         <object name="Invoice">
> >             <hasMany name="Customer">
> >                 <link name="CustomerInvoice"/>
> >             </hasMany>
> >         </object>
> >
> >         <object name="CustomerInvoice">
> >             <hasOne name="customer">
> >                 <relate from="customerId"
> > to="customerId"/>
> >             </hasOne>
> >             <hasOne name="Invoice">
> >                 <relate from="invoiceId" to="invoiceId"/>
> >             </hasOne>
> >         </object>
> >
> >
> > If I am in my admin area and viewiing a customers
> > invoices i can loop them
> > using the following query
> >
> > <cfset customerRecord =
> > application.cs.getBean("CustomerRecord")>
> > <cfset customer = customerRecord.load(customerId=url.id)>
> >
> > <cfset invoices =
> > customer.getInvoiceIterator()._getQuery()>
> >
> > So Up to there works fine, the question I have is, when I
> > am looping the
> > invoices query how do i find the related id's? In the
> > CustomerInvoice table
> > there is customerInvoiceID,customerId,invoiceId, I
> > specifically need the
> > customerInvoiceID each time I pass through the loop.
> >
> >
> >
> > --
> > Dan Vega
> > [EMAIL PROTECTED]
> >
> >
> > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > -- -- -- -- -- -- -- --
> > 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/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --



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

<<winmail.dat>>

Reply via email to