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


Query of Query from a Custom tag

Posted on 2004-10-22
Medium Priority
Last Modified: 2013-12-24
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 name="qryDistinctColumns" dbtype="query">
     select distinct #attributes.SomeColumn# from #evaluate("caller.#attributes.QueryName#)#
Question by:mts1701
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

Accepted Solution

umbrae earned 750 total points
ID: 12380993
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.


Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

610 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