Query of Query from a Custom tag

Posted on 2004-10-22
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
    1 Comment
    LVL 5

    Accepted Solution

    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
    Article by: kevp75
    Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    931 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now