Returning Specific Scopes From Within CFXs

This wasn’t always possible, and I don’t know when it become possible, but as I am working with Java CFX code now and am using this feature I thought I’d share.
The CFXAPI (used in creating CFX tags in C/C++ or Java) exposes a limited subset of the ColdFusion world to your code. One of the things is does allow is for the creation of variables and queries, typically a variable or query name would be passed to the CFX tag and the CFX code would create a variable or query of that name in the VARIABLES scope in the caller page. However, you are not limited to just using the VARIABLES scope. While CFX code itself is for the most part not really scope aware, if the query name (for example) passed to the tag were the data query will be created in the SESSION scope. In fact, even though the CFXAPI does not support structures, you could specify a variable using dot notation (like mystruct.myvar) and the variable created will indeed be a member of a structure.

2 responses to “Returning Specific Scopes From Within CFXs”

  1. AndyR Avatar

    Perhaps this became possible with CFMX. ISTR that was when it became possible to implicitly define structures via the dot notation.

  2. Ben Forta Avatar
    Ben Forta

    Yep, very likely, I just don’t have prior versions installed to test against.

Leave a Reply