This is what I would do:
<cfset customerRecord =
application.cs.getBean("CustomerRecord")>
<cfset customer = customerRecord.load(customerId=url.id)>
<cfset invoices = customer.getInvoiceIterator()>
<cfset customer = customerRecord.load(customerId=url.id)>
<cfset invoices = customer.getInvoiceIterator()>
<cfloop condition="#invoices.hasMore()#">
<cfset currentInvoice = invoices.getNext()
/><!--- currentInvoice is an InvoiceRecord
--->
<!--- do what ever i need
here. --->
</cfloop>
Jonathan Works
Enterprise Application Architect
Bright
House Networks
Advanced Broadband Services
Tampa Bay
Division
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Vega
Sent: Monday, July 10, 2006 12:52 PM
To: [email protected]
Subject: [Reactor for CF] Re: Iterator Quesion
On 7/10/06, 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]
--
Dan Vega
[EMAIL PROTECTED]
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --CONFIDENTIALITY NOTICE: This e-mail may contain information that is privileged, confidential or otherwise protected from disclosure. If you are not the intended recipient of this e-mail, please notify the sender immediately by return e-mail, purge it and do not disseminate or copy it.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Reactor for ColdFusion Mailing List
[email protected]
Archives at: http://www.mail-archive.com/reactor%40doughughes.net/
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
