• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Query of Query from a Custom tag

Can anybody tell me... would it be possible (in a custom tag) to perform a query on a query from the calling page (or caller scope)?
In other words, if I pass the name of a query to the custom tag, is there some way I can then query that query from within th custom tag?  If so, how might I reference it?

I've tried the following and nothing was worked for me yet.

<cfquery name="qryDistinctColumns" dbtype="query">
     select distinct #attributes.SomeColumn# from #attributes.QueryName#
</cfquery>

<cfquery name="qryDistinctColumns" dbtype="query">
     select distinct #attributes.SomeColumn# from #evaluate("caller.#attributes.QueryName#)#
</cfquery>
0
mts1701
Asked:
mts1701
1 Solution
 
umbraeCommented:
If your variable is in a different scope inside the caller scope (for example, form), it won't work correctly. (At least, I assume)

What you might try is a <cfdump var="#caller#"> and see if you can locate your query within there. If you can, figuring out how to evaluate it to get at it should be fairly trivial.

Also, this may be slight help - if you're insistent on using this custom tag, try setting the query in the calling page to variables.QueryName instead of just QueryName. The tag might find it in the caller scope then.

Just my 2 cents.

-Umbrae
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now