Making attributes variables outside cfc
Hi, I have a cfc. I am trying to convert several variables into attributes variables from inside a method, but of course, these variables are not available outside the cfc. I can convert them into form or URL variables, but not attributes. Is there a way I can make these attributes available outside the cfc? Johnny ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209842 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Making attributes variables outside cfc
On 6/17/05, Johnny Le [EMAIL PROTECTED] wrote: I have a cfc. I am trying to convert several variables into attributes variables from inside a method, but of course, these variables are not available outside the cfc. I can convert them into form or URL variables, but not attributes. Is there a way I can make these attributes available outside the cfc? CFCs are encapsulated to prevent that sort of thing. However, if you pass in the attributes struct as an argument to your method, the method can store values into it via the argument: In the CFC: cffunction name=foo cfargument name=attributes type=struct cfset arguments.attributes.answer = 42 /cffunction In the calling code: cfset myObj.foo(attributes) Another option would be to create and return a struct in the function and have the calling code append that to its attributes: In the CFC: cffunction name=foo returntype=struct cfset var attr = structNew() cfset attr.answer = 42 cfreturn attr /cffunction In the calling code: cfset newAttr = myObj.foo() cfset structAppend(attributes,newAttr) HTH -- Sean A Corfield -- http://corfield.org/ Team Fusebox -- http://fusebox.org/ Got Gmail? -- I have 50, yes 50, invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209848 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Making attributes variables outside cfc
Yep, I am currently using the second method. Thanks, Sean. What is HTH? Johnny On 6/17/05, Johnny Le [EMAIL PROTECTED] wrote: I have a cfc. I am trying to convert several variables into attributes variables from inside a method, but of course, these variables are not available outside the cfc. I can convert them into form or URL variables, but not attributes. Is there a way I can make these attributes available outside the cfc? CFCs are encapsulated to prevent that sort of thing. However, if you pass in the attributes struct as an argument to your method, the method can store values into it via the argument: In the CFC: cffunction name=foo cfargument name=attributes type=struct cfset arguments.attributes.answer = 42 /cffunction In the calling code: cfset myObj.foo(attributes) Another option would be to create and return a struct in the function and have the calling code append that to its attributes: In the CFC: cffunction name=foo returntype=struct cfset var attr = structNew() cfset attr.answer = 42 cfreturn attr /cffunction In the calling code: cfset newAttr = myObj.foo() cfset structAppend(attributes,newAttr) HTH -- Sean A Corfield -- http://corfield.org/ Team Fusebox -- http://fusebox.org/ Got Gmail? -- I have 50, yes 50, invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209884 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Making attributes variables outside cfc
Hope That Helps HTH, Ray :) Johnny Le wrote: Yep, I am currently using the second method. Thanks, Sean. What is HTH? Johnny On 6/17/05, Johnny Le [EMAIL PROTECTED] wrote: I have a cfc. I am trying to convert several variables into attributes variables from inside a method, but of course, these variables are not available outside the cfc. I can convert them into form or URL variables, but not attributes. Is there a way I can make these attributes available outside the cfc? CFCs are encapsulated to prevent that sort of thing. However, if you pass in the attributes struct as an argument to your method, the method can store values into it via the argument: In the CFC: cffunction name=foo cfargument name=attributes type=struct cfset arguments.attributes.answer = 42 /cffunction In the calling code: cfset myObj.foo(attributes) Another option would be to create and return a struct in the function and have the calling code append that to its attributes: In the CFC: cffunction name=foo returntype=struct cfset var attr = structNew() cfset attr.answer = 42 cfreturn attr /cffunction In the calling code: cfset newAttr = myObj.foo() cfset structAppend(attributes,newAttr) HTH -- Sean A Corfield -- http://corfield.org/ Team Fusebox -- http://fusebox.org/ Got Gmail? -- I have 50, yes 50, invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209885 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54