?
Solved

How do i pass a named parameter to a UDF?

Posted on 2009-07-09
4
Medium Priority
?
258 Views
Last Modified: 2013-12-24
I have a UDF which I got from cflib.org
http://cflib.org/udf/QueryToCSV2

The UDF = QueryToCSV2(query [, headers] [, cols])

My Question:

How do i pass these params to the UDF

query=MyQuery
headers=FirstName,LastName,Phone
cols=First_Name,Last_name,phonenumber

How would I write the code:
like
#QueryToCSV2(MyQuery,(FirstName,LastName,Phone),(First_Name,Last_name,phonenumber)#

This does not work any ideas?

0
Comment
Question by:LeadCo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
azadisaryev earned 2000 total points
ID: 24818272
just do it like this:

<cfquery name="myQuery" ...>
...
</cfquery>
<cfset headers = "FirstName,LastName,Phone">
<cfset cols = "First_Name,Last_name,phonenumber">
<cfset myCSV = QueryToCSV2(myQuery, headers, cols)>

Azadi
0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 24818340
If I am understanding correctly, you want to pass in a parameter instead of literals for column headings / name you can try like this.

I don't have CF on this machine to test, but can also try EVAL(
<cfset test = QueryToCSV2(MyQuery, FirstName & "," & LastName & "," & Phone, First_Name & "," & Last_name & "," & phonenumber)>
 
<!--- don't believe it is needed on right side of cfset, but can add ## --->
<cfset test = QueryToCSV2(MyQuery, #FirstName# & "," & #LastName# & "," & #Phone#, #First_Name# & "," & #Last_name# & "," & #phonenumber#)>

Open in new window

0
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 24818357
Please ignore this part *I don't have CF on this machine to test, but can also try EVAL(
That is what the second was showing using the #variablename# as I read your question to mean that FirstName was a named parameter, etc.
0
 

Author Closing Comment

by:LeadCo
ID: 31601803
Thanks!
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question