RE: cffunction with a loop inside - need some advice
I was not sure if you needed to invoke this as a web service or simply an object, so I wrote up each. This makes one call for each 'class' that needs to be created. If you wanted to reduce hits on your database, I would refactor this to take an array of structures of 'classes' as an argument and then loop over the array and do the inserts from that. INSERT INTO participants ( enrID, part_class ) VALUES ( , ) HTH, Rich Kroll > -Original Message- > From: Les Mizzell [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 14, 2006 9:36 PM > To: CF-Talk > Subject: cffunction with a loop inside - need some advice > > OK - before I tried turning this particular problem into a service, I > had a simple query like this, which works (examples simplified for > clarity, whatever that is!): > > > > INSERT INTO participants ( > enrID, > part_class ) >VALUES ( > #evaluate("form.enrID#idx#")#, > '#evaluate("form.part_class#idx#")#' ) > > > > > The function to handle this once converted is failing with 'Can't > generate stubblan, blah so I've got a syntax problem or just > simply don't know what I'm doing trying to translate the above. > > Here's what I've got: > > To invoke the beast: > > method="ENROLLMENTS" >WStotalPERSONS="#form.totalPERSONS#" > > WSenrID#idx#="#evaluate("form.enrID#idx#")#" > WSpart_class#idx#="#evaluate("form.part_class#idx#")#" > > > > > > > And here's the function: > > access="remote" > returntype="query" > > > > > > > > from="1" to="#WStotalPERSONS#" index="idx"> > > INSERT INTO participants ( >enrID, >part_class ) > VALUES ( >WSenrID#idx#, >'WSpart_class#idx#")#' ) > > > > > > > > I probably need to rethink the way this particular function has to work, > but I desperately need some pointers please! > > Thanks, > > > Les > > > ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264107 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cffunction with a loop inside - need some advice
I'm completely stumped. Nothing I've tried seems to work. All I need to do is turn the query below, which inserts multiple records, into a function and then invoke that function. INSERT INTO participants ( enrID, part_class ) VALUES ( #evaluate("form.enrID#idx#")#, '#evaluate("form.part_class#idx#")#' ) How would you folks handle this? ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264102 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
cffunction with a loop inside - need some advice
OK - before I tried turning this particular problem into a service, I had a simple query like this, which works (examples simplified for clarity, whatever that is!): INSERT INTO participants ( enrID, part_class ) VALUES ( #evaluate("form.enrID#idx#")#, '#evaluate("form.part_class#idx#")#' ) The function to handle this once converted is failing with 'Can't generate stubblan, blah so I've got a syntax problem or just simply don't know what I'm doing trying to translate the above. Here's what I've got: To invoke the beast: WSenrID#idx#="#evaluate("form.enrID#idx#")#" WSpart_class#idx#="#evaluate("form.part_class#idx#")#" > And here's the function: INSERT INTO participants ( enrID, part_class ) VALUES ( WSenrID#idx#, 'WSpart_class#idx#")#' ) I probably need to rethink the way this particular function has to work, but I desperately need some pointers please! Thanks, Les ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264101 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: cffunction with a loop inside - need some advice
Despite my obvious error in the query itself, the function error seems to be caused by the loop: WSenrID#idx#="#evaluate("form.enrID#idx#")#" WSpart_class#idx#="#evaluate("form.part_class#idx#")#" If I remove the loop - it validates properly. OK, how do I get a loop of the value "WStotalPERSONS" to work inside a function? ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264099 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4