Dan,

 

The way I’ve always done it is like this

 

<cfset var newArray = arrayNew(1) />

<!--- create someRecord using reactor -à

 

<cfloop from=”1” to=”3” index=”i”><!--- loop through form data or query object or list….. whatever holds your data -à

<cfset arrayAppend(newArray, someRecord.getMyIterator.Add()) />

            <cfset newArray[i].setMy_name(“Ryan”) />

</cfloop>

<cfset someRecord.Validate() />

<cfif someRecord.hasErrors()>

            <!--- throw error -à

<cfelse>

            <cfset someRecord.Save() />

</cfif>

 

 

Reactor is smart enough to see that someRecord has children and will validate and save them.

 

 

Ryan Blatz

Systems Developer/Engineer

College of Education and Human Ecology - The Ohio State University


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Sorensen
Sent: Thursday, October 19, 2006 2:34 PM
To: [email protected]
Subject: [Reactor for CF] How should I save changes to iterated records?

 

Given the example on this page: http://livedocs.reactorframework.com/Other_Types_of_Relationships.htm

 

How would one save changes to customer records that were retrieved via the getCustomerIterator()? The page says that “there is no setCustomerIterator() method”. Looking at the iterator.cfc, I see there are delete(), deleteAll() and add() methods. Do I work with those methods to remove/add/update iterated records? If so, do I save each iterated record separately or do the saves commit when I save the parent record?

 

I’m interested in any previous thread or bit of documentation that would clarify the best practice.

 

Dan

 


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