Ok, Claude has replied to me off-list, and as such I will not repeat here what 
he wrote and what I shared in reply (it was a lot).  :-)

It just seems that the bottom line is that he was not that familiar with 
calling functions at all, so I showed him how to do that. 

But his code also showed he was missing some of the values of arguments 
expected in this function (which I could determine he’d gotten at 
http://www.cflib.org/udf/getHaversineDistance ). 

I shared some more observations for him, but I have to head to bed now so I’ll 
pass the baton back to the list. :-) I’ve suggested he ask here if he has 
follow-on questions, and I hope he’ll choose to share the entire note he wrote 
and as I replied to it, if it will be necessary for any of you to help him out 
further.

Claude, if you get it sorted on your own, do drop us a note to say so, and that 
would be great to hear, and happy to have helped.

/charlie

 

From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of 
Charlie Arehart
Sent: Thursday, March 26, 2015 12:12 AM
To: cfaussie@googlegroups.com
Subject: RE: [cfaussie] Help With Dynamic Naming A CfScript Function

 

Claude, I’m not picking a fight but I don’t see how that answers my question at 
all. The good news is that I think you are very close to a solution, but you 
seem to have missed what I said.

Why do you have the function being defined within this query loop you refer to 
(in words, but don’t reflect in the code). Are you saying, perhaps, that some 
of the variables within the function are references to query variables? I don’t 
see that. It seems the UDF (user-defined function) is self-contained, and it 
operates on whatever is passed into it.

So I’ll ask again: why don’t you simply put this *definition* of the function 
OUTSIDE the loop and just *call the function from within the loop*, passing it 
the values within the loop on which you want to perform these calculations?

And your subject and initial question refer to this being about “dynamic 
naming” of the function, but your code below shows no such thing. When you said 
in your first note that you were trying to do that with “function 
getDistance#id#”, I wonder: were you trying that simply because you were 
getting the error about not being able to duplicate the function? Again, you 
don’t need to have the function being duplicated. 

Just move the function out of the loop and you should be all set. :-)

/charlie

 

-- 
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cfaussie+unsubscr...@googlegroups.com.
To post to this group, send email to cfaussie@googlegroups.com.
Visit this group at http://groups.google.com/group/cfaussie.
For more options, visit https://groups.google.com/d/optout.

Reply via email to