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]

