> everytime the application.cfm file does it
> just does it once and caches it?
Yup! Cool huh?
-Cameron
-----------------
Cameron Childress
Sumo Consulting Inc
---
land: 858.509.3098
cell: 678.637.5072
aim: cameroncf
email: [EMAIL PROTECTED]
-----Original Message-----
From: Stuart Kidd [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 08, 2004 2:47 PM
To: CF-Talk
Subject: RE: Database Joins
Thanks for that. I just put the not structkeyExists bit in with the
query into my application.cfm file for the time being. So I take it,
instead of that query loading everytime the application.cfm file does it
just does it once and caches it?
-----Original Message-----
From: Cameron Childress [mailto:[EMAIL PROTECTED]
Sent: 08 February 2004 22:18
To: CF-Talk
Subject: RE: Database Joins
> Thanks Cameron, do you mean for me to put that cfif into my
> application.cfm file?
You could put it there if you wanted. You could also put it into it's
own
file and include it into the application.cfm or the page you are using
the
query on. From the looks of it, you are just getting your feet wet in
CF so
Application.cfm is most likely the best location for your app. In the
long
run you may decide to move it into a different place, but
application.cfm
will work just fine for now. Either way, I'd pick a method and stick to
it...
> What does that structkeyExists mean?
If you don't have printed documentation available the Livedocs are
available
here:
http://livedocs.macromedia.com
The application scope is treated like a structure by ColdFusion, so you
can
refer to it as:
application.GetPropertyCountryList
or
application['GetPropertyCountryList']
More about structures can also be found in the livedocs. Teach a man to
fish and all that...
-Cameron
-----------------
Cameron Childress
Sumo Consulting Inc
---
land: 858.509.3098
cell: 678.637.5072
aim: cameroncf
email: [EMAIL PROTECTED]
-----Original Message-----
From: Stuart Kidd [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 08, 2004 2:10 PM
To: CF-Talk
Subject: RE: Database Joins
Thanks Cameron, do you mean for me to put that cfif into my
application.cfm file?
What does that structkeyExists mean?
Cheers,
Stuart
-----Original Message-----
From: Cameron Childress [mailto:[EMAIL PROTECTED]
Sent: 08 February 2004 21:50
To: CF-Talk
Subject: RE: Database Joins
Typically, if you are pulling out all the information about the agent,
and
need the PropertyCountryListID for that agent preselected, you're going
to
want to stick with two queries.
It looks like the list of countries is not likely to change very often.
My
suggestion here would be to cache the GetPropertyCountryList query in
the
application scope and re-use it as needed.
IE:
<cfif not structkeyExists(Application,'GetPropertyCountryList')>
<CFQUERY NAME="Application.GetPropertyCountryList" datasource="020">
SELECT PropertyCountryListID, PropertyCountryListName
FROM PropertyCountryList
ORDER by PropertyCountryListName ASC
</CFQUERY>
</cfif>
Then you can use the query on your code like this:
<cfoutput query="Application.GetPropertyCountryList">
...
This assumes you have CF's application framework enabled and are using
MX.
On older versions of CF, you'd also want to add some locking in there
for
the shared scopes.
-Cameron
-----------------
Cameron Childress
Sumo Consulting Inc
---
land: 858.509.3098
cell: 678.637.5072
aim: cameroncf
email: [EMAIL PROTECTED]
-----Original Message-----
From: Stuart Kidd [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 08, 2004 1:37 PM
To: CF-Talk
Subject: Database Joins
Hi guys,
I'm trying to do one database query (SELECT) without having to do 2
separate ones.
I have two tables. One called PropertyAgent and then another called
PropertyCountryList.
In PropertyAgent, there is a field called PropertyAgentCountry (numeric)
which was inserted originally using a choice of the field
PropertyCountryListID (numeric) from table PropertyAgentCountry.
At the moment I have two queries, but I'm thinking there must be away
around it.
// getting the agent details info (which country he is from)
<CFQUERY NAME="AgentDetails" datasource="020">
SELECT PropertyAgentID, PropertyAgentCountry
FROM PropertyAgent
WHERE PropertyAgentID = #Client.PropertyAgentID#
</CFQUERY>
// getting list of countries to populate form
<CFQUERY NAME="GetPropertyCountryList" datasource="020">
SELECT PropertyCountryListID, PropertyCountryListName
FROM PropertyCountryList
ORDER by PropertyCountryListName ASC
</CFQUERY>
// outputting to the form.
<cfselect name="PropertyAgentCountry" class="FormSTYLE2">
<cfoutput query="GetPropertyCountryList">
<option value="#PropertyCountryListID#" <cfif PropertyCountryListID is
AgentDetails.PropertyAgentCountry>selected</cfif>>#PropertyCountryListNa
me#</option>
</cfoutput>
</cfselect>
Any ideas greatly appreciated,
Stuart
_____
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

