>> On Friday 20 Jun 2008, Rick Faircloth wrote:
>> > What would be the best way to pass variables to a CFC
>> > for processing?

To go back to this question, there are several methods for passing in
variables. There is no really best way, it is more a matter of
personal preference. Besides the use of cfinvoke, here are some ways
to do it with <cfset>.

1) Named arguments. Here you actually specify the argument names when
you call a method
<cfset myQuery = someObject.getMyQuery(myFirstArgument=form.criteria,
mySecondArgument=form.moreData) />

2) Unnamed arguments. Here you just put in the variables in the same
order in which you specify the arguments in the function.
<cfset myQuery = someObject.getMyQuery(form.criteria,form.moreData) />

3) Argument collection. Here you first build up a structure that holds
the arguments. Structure keys match the argument names.
<cfset myStruct = structNew() />
<cfset myStruct.myFirstArgument = form.criteria />
<cfset myStruct.mySecondArgument = form.moreData />
<cfset myQuery = someObject.getMyQuery(argumentCollection=myStruct) />


-- 
Matt Williams
"It's the question that drives us."

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307828
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to