House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

using name of query in QofQ form custom tag

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Okay here is what I am trying to do:
Tony Bentley
03/12/10 03:27 P
Is it possible that you need to use:
G Allen R Souliere
03/12/10 03:39 P
You need to do this:
Barney Boisvert
03/12/10 03:43 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tony Bentley
03/12/2010 03:27 PM

Okay here is what I am trying to do: <tag:customtag query="testquery"> customtag: <cfquery dbtype="query" name="#attributes.query#"> select * from #attributes.query# </cfquery Obviously the name="#attributes.query#" does not work. Any ideas?

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
G Allen R Souliere
03/12/2010 03:39 PM

Is it possible that you need to use: name="#Evaluate(attributes.query)#" Allen On 12-Mar-10, at 12:19 PM, Tony Bentley wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Barney Boisvert
03/12/2010 03:43 PM

You need to do this: <cfset myQuery = caller[attributes.query] /> <cfquery dbtype="query" name="caller.#attributes.query#"> select * from myQuery </cfquery> The first line pulls the query object from the caller scope down into the current variables scope where the QofQ can successfully dereference it.  If you'd like to preserve the original query name (perhaps for nicer error messages), you can do it this way: <cfset variables[attributes.query] = caller[attributes.query] /> <cfquery dbtype="query" name="caller.#attributes.query#"> select * from #attributes.query# </cfquery> Note also the addition of "caller." in the name attribute of the CFQUERY tag, which you didn't explicit state you wanted, but judging from the code, I suspect is the case. cheers, barneyb ----- Excess quoted text cut - see Original Post for more ----- -- Barney Boisvert bboisvert@gmail.com http://www.barneyb.com/

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tony Bentley
03/12/2010 04:03 PM

Nice Barney! I didn't even think about using caller. Thanks!


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

July 31, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
         1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31