Calling the same UDF twice..
Anyone ever seen a situation like this: You define a function (some arbitrary function) cffunction name=fun1 HI /cffunction And then can't call it twice in a row? cfset fun1() cfset fun1() The second time it says that fun1 is not defined, but if you comment out the first call the second runs fine.. If anyone has seen this, or is interested in how to recreate, let me know. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243054 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: Calling the same UDF twice..
Just out of curiousity, try assigning it to a variable in both cases... cfset dummy = foo() / cfset dummy2 = foo() / I've never seen the case you're talking about, but function names are set in the variables scope and that has caused me other hearburn on occasion. I wonder if something is going on with that? On 6/9/06, Daniel Baughman [EMAIL PROTECTED] wrote: Anyone ever seen a situation like this: You define a function (some arbitrary function) cffunction name=fun1 HI /cffunction And then can't call it twice in a row? cfset fun1() cfset fun1() The second time it says that fun1 is not defined, but if you comment out the first call the second runs fine.. If anyone has seen this, or is interested in how to recreate, let me know. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243055 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: Calling the same UDF twice..
Can you show us the real code? On 6/9/06, Daniel Baughman [EMAIL PROTECTED] wrote: Anyone ever seen a situation like this: You define a function (some arbitrary function) cffunction name=fun1 HI /cffunction And then can't call it twice in a row? cfset fun1() cfset fun1() The second time it says that fun1 is not defined, but if you comment out the first call the second runs fine.. If anyone has seen this, or is interested in how to recreate, let me know. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243056 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: Calling the same UDF twice..
Just a guess: Because you are setting the value of the function Fun1() to nothing? Don't you want: cfset temp=fun1() cfset temp=fun1() not cfset fun1() (which replaces the value of fun1() with null)? On 6/9/06, Raymond Camden [EMAIL PROTECTED] wrote: Can you show us the real code? On 6/9/06, Daniel Baughman [EMAIL PROTECTED] wrote: Anyone ever seen a situation like this: You define a function (some arbitrary function) cffunction name=fun1 HI /cffunction And then can't call it twice in a row? cfset fun1() cfset fun1() The second time it says that fun1 is not defined, but if you comment out the first call the second runs fine.. If anyone has seen this, or is interested in how to recreate, let me know. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243058 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: Calling the same UDF twice..
You define a function (some arbitrary function) cffunction name=fun1 HI /cffunction And then can't call it twice in a row? cfset fun1() cfset fun1() Do you do anything to the fun1 value? The variable can be redefined at any time to be something other then a function. Either of these would be a problem cfunction name=fun1 cfset fun1 = HI /cfunction OR cfoutput#fun1()#/cfoutput cfset fun1 = George cfoutput#fun1()#/cfoutput I suspect something closer to the former issue from what you have described. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Soduko | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243061 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: Calling the same UDF twice..
I have tried calling the functions like this: cfscript updateUser(valueUseList, fieldUseList, form.u1id); /cfscript cfscript updateUser(valueUseList, fieldUseList, form.u1id); /cfscript The second time it will throw the error that the function is undefined, if I comment out the first call, the second call works just fine. Here is the actual function: cffunction name=updateUser cfargument name=valueUseList required=true type=string cfargument name=fieldUseList required=true type=string cfargument name=userId required=true type=numeric cfif listlen(fielduselist, |) gt 0 cfquery name=updateUser datasource=xxx Update myTable set cfloop from=1 to=#listLen(fieldUseList, |)# index=i cfoutput #listgetat(fieldUseList,i, | )# = cfqueryparam value=#listgetat(valueUseList,i, |)# cfsqltype=cf_sql_varchar cfif listLen(fieldUseList, |) gt i,/cfif /cfoutput /cfloop where tableId = cfoutput'#userid#'/cfoutput /cfquery cfelse No data given to update user cfoutput#userId#/cfoutput... /cfif cfreturn /cffunction Daniel Baughman -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Friday, June 09, 2006 10:39 AM To: CF-Talk Subject: Re: Calling the same UDF twice.. Can you show us the real code? On 6/9/06, Daniel Baughman [EMAIL PROTECTED] wrote: Anyone ever seen a situation like this: You define a function (some arbitrary function) cffunction name=fun1 HI /cffunction And then can't call it twice in a row? cfset fun1() cfset fun1() The second time it says that fun1 is not defined, but if you comment out the first call the second runs fine.. If anyone has seen this, or is interested in how to recreate, let me know. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243062 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: Calling the same UDF twice..
Oh your exactly right, my previous post proved it. In the function I have a query named updateUser that is replacing the function. Thanks for the help. -Original Message- From: Ian Skinner [mailto:[EMAIL PROTECTED] Sent: Friday, June 09, 2006 11:07 AM To: CF-Talk Subject: RE: Calling the same UDF twice.. You define a function (some arbitrary function) cffunction name=fun1 HI /cffunction And then can't call it twice in a row? cfset fun1() cfset fun1() Do you do anything to the fun1 value? The variable can be redefined at any time to be something other then a function. Either of these would be a problem cfunction name=fun1 cfset fun1 = HI /cfunction OR cfoutput#fun1()#/cfoutput cfset fun1 = George cfoutput#fun1()#/cfoutput I suspect something closer to the former issue from what you have described. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Soduko | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243064 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: Calling the same UDF twice..
Here is the actual function: cffunction name=updateUser cfquery name=updateUser datasource=xxx And here is your problem. After the cfquery line the variable updateUser is a recordSet not a function. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Soduko | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243065 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: Calling the same UDF twice..
cffunction name=updateUser . cfquery name=updateUser datasource=xxx And here is your problem. After the cfquery line the variable updateUser is a recordSet not a function. And a solution, other then changing the query name is you can use local variable. cffunction name=updateUser cfargument cfargument ... cfset var updateUser = . cfquery name=updateUser datasource=xxx This should create the existence of an updateUser local to the function that is different then the update use in the pages variables scope. Not sure this is the best way to solve this problem, but it is a good idea to var scope any variables used inside of functions to prevent this kind of problem. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Soduko | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243066 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