Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do i pass a named parameter to a UDF?

Posted on 2009-07-09
4
Medium Priority
?
259 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

609 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