|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
using name of query in QofQ form custom tag
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 Nice Barney! I didn't even think about using caller. Thanks!Tony Bentley 03/12/10 04:03 P 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? 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 ----- 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/ Nice Barney! I didn't even think about using caller. Thanks!
|
July 31, 2010
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||