Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 619767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:41:27+00:00 2026-05-13T18:41:27+00:00

For my lookup tables, the ones that are the same for every user in

  • 0

For my lookup tables, the ones that are the same for every user in the application, I do an

Application.objectname = createobject(...).init(datasource)

in the init method, I read the table into the this scope like so:

cfquery name="this.queryname"
return this

Now, whenever I need to reference the query, I can refer to it like this:

cfselect query="Application.objectname.queryname" ...

Q: Is there anything wrong with that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:41:27+00:00Added an answer on May 13, 2026 at 6:41 pm

    No, that would be fine. The server will keep the entire object instance in memory as part of the application scope, which will include all of its properties.

    As a question of style, I would suggest making your query a private property (in the variables scope in a CFC) rather than a public one (in a CFC’s this scope). Allowing an object property to be public implies that as the black box designer, you’re okay with an unknown developer overwriting the value. If these are database lookup tables you’re storing, I’m guessing you intend this data to be read-only. Consider the following:

    <cfcomponent hint="Proxy for database lookup tables" output="false">
        <cfproperty name="variables.lookupTable1" type="query" hint="[Private] lookupTable1 query object." />
        <cfproperty name="variables.lookupTable2" type="query" hint="[Private] lookupTable2 query object." />
        <!--- Implicit initialization --->
        <cfscript>
            variables.lookupTable1 = QueryNew('');
            variables.lookupTable2 = QueryNew('');
        </cfscript>
    
        <!--- Active initialization --->
        <cffunction name="init" returntype="void" access="public" hint="Initializes the query objects with data." output="false">
            <cfargument name="dsn" type="string" required="true" hint="The datasource to use." />
            <cfquery name="variables.lookupTable1" datasource="#arguments.dsn#">
                SELECT * FROM [TblFoo]
            </cfquery>
            <cfquery name="variables.lookupTable2" datasource="#arguments.dsn#">
                SELECT * FROM [TblBar]
            </cfquery>
        </cffunction>
    
        <!--- Data Fetching Methods --->
        <cffunction name="getFoo" returntype="query" access="public" hint="Returns the contents of TblFoo." output="false">
            <cfreturn variables.lookupTable1 />
        </cffunction>
    
        <cffunction name="getBar" returntype="query" access="public" hint="Returns the contents of TblFoo." output="false">
            <cfreturn variables.lookupTable2 />
        </cffunction>
    </cfcomponent>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have many tables that use Lookup/Enum references for most of their column values.
Is empty lookup table the same as non-matching lookup table in lookup transform? What
I have a few lookup tables that I am in the process of plumbing
I am developing an app that utilizes very large lookup tables to speed up
In a multilanguage application with lookup tables, what's the best way to handle translations?
I have an application where the database back-end has around 15 lookup tables. For
In my application, I have a a number of simple reference/lookup database tables used
A lot of the applications I write make use of lookup tables, since that
I have a django application which has one main table/model which references various 'lookup'
Whats the easiest way to implement a lookup table that checks to see if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.